cvs: php4 /main output.c php_output.h

From: Date: Mon, 05 Aug 2002 18:54:53 +0000
Subject: cvs: php4 /main output.c php_output.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-13140@lists.php.net to get a copy of this message
helly Mon Aug 5 14:54:53 2002 EDT Modified files: /php4/main output.c php_output.h Log: Added php_ob_handler_used to check if a specific output handler is used in c. Index: php4/main/output.c diff -u php4/main/output.c:1.104 php4/main/output.c:1.105 --- php4/main/output.c:1.104 Sun Aug 4 23:09:42 2002 +++ php4/main/output.c Mon Aug 5 14:54:53 2002 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: output.c,v 1.104 2002/08/05 03:09:42 helly Exp $ */ +/* $Id: output.c,v 1.105 2002/08/05 18:54:53 helly Exp $ */ #include "php.h" #include "ext/standard/head.h" @@ -400,6 +400,40 @@ } php_ob_list_each(&OG(active_ob_buffer), return_value); } +} +/* }}} */ + +/* {{{ php_ob_used_each + Sets handler_name to NULL is found + */ +static int php_ob_handler_used_each(php_ob_buffer *ob_buffer, char **handler_name) +{ + if ((!strcmp(ob_buffer->handler_name, "zlib output compression") && ob_buffer->internal_output_handler && !strcmp("ob_gzhandler", *handler_name)) + || !strcmp(ob_buffer->handler_name, *handler_name)) + { + *handler_name = NULL; + return 1; + } + return 0; +} +/* }}} */ + +/* {{{ php_ob_used + returns 1 if given handler_name is used as output_handler + */ +PHPAPI int php_ob_handler_used(char *handler_name TSRMLS_DC) +{ + char *tmp = handler_name; + + if (OG(ob_nesting_level)) { + if (!strcmp(OG(active_ob_buffer).handler_name, handler_name)) { + return 1; + } + if (OG(ob_nesting_level)>1) { + zend_stack_apply_with_argument(&OG(ob_buffers), ZEND_STACK_APPLY_BOTTOMUP, (int (*)(void *element, void *)) php_ob_handler_used_each, &tmp); + } + } + return tmp ? 0 : 1; } /* }}} */ Index: php4/main/php_output.h diff -u php4/main/php_output.h:1.38 php4/main/php_output.h:1.39 --- php4/main/php_output.h:1.38 Sun Aug 4 23:09:42 2002 +++ php4/main/php_output.h Mon Aug 5 14:54:53 2002 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_output.h,v 1.38 2002/08/05 03:09:42 helly Exp $ */ +/* $Id: php_output.h,v 1.39 2002/08/05 18:54:53 helly Exp $ */ #ifndef PHP_OUTPUT_H #define PHP_OUTPUT_H @@ -39,6 +39,7 @@ PHPAPI char *php_get_output_start_filename(TSRMLS_D); PHPAPI int php_get_output_start_lineno(TSRMLS_D); PHPAPI void php_ob_set_internal_handler(php_output_handler_func_t internal_output_handler, uint buffer_size, char *handler_name, zend_bool erase TSRMLS_DC); +PHPAPI int php_ob_handler_used(char *handler_name TSRMLS_DC); PHP_FUNCTION(ob_start); PHP_FUNCTION(ob_flush);

« previous php.cvs (#13140) next »