]> granicus.if.org Git - php/commitdiff
- explicit usage of TS macros
authorMichael Wallner <mike@php.net>
Sat, 3 Jun 2006 11:19:44 +0000 (11:19 +0000)
committerMichael Wallner <mike@php.net>
Sat, 3 Jun 2006 11:19:44 +0000 (11:19 +0000)
# this could have been raised a lot earlier

19 files changed:
ext/session/session.c
ext/soap/soap.c
ext/standard/basic_functions.c
ext/standard/head.c
ext/standard/info.c
ext/standard/url_scanner_ex.c
ext/standard/url_scanner_ex.re
ext/standard/var.c
ext/tidy/tidy.c
ext/zlib/zlib.c
main/SAPI.c
main/main.c
main/output.c
main/php_output.h
sapi/apache/mod_php5.c
sapi/apache2handler/php_functions.c
sapi/apache_hooks/mod_php5.c
sapi/cli/php_cli.c
sapi/nsapi/nsapi.c

index 76394ba080a1c60c13f894a72db891703fc698bc..e41a429fd5dca75df7fddb77b85f1614a2b4f32e 100644 (file)
@@ -855,8 +855,8 @@ static int php_session_cache_limiter(TSRMLS_D)
        if (PS(cache_limiter)[0] == '\0') return 0;
        
        if (SG(headers_sent)) {
-               char *output_start_filename = php_output_get_start_filename();
-               int output_start_lineno = php_output_get_start_lineno();
+               char *output_start_filename = php_output_get_start_filename(TSRMLS_C);
+               int output_start_lineno = php_output_get_start_lineno(TSRMLS_C);
 
                if (output_start_filename) {
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot send session cache limiter - headers already sent (output started at %s:%d)",
@@ -889,8 +889,8 @@ static void php_session_send_cookie(TSRMLS_D)
        char *date_fmt = NULL;
 
        if (SG(headers_sent)) {
-               char *output_start_filename = php_output_get_start_filename();
-               int output_start_lineno = php_output_get_start_lineno();
+               char *output_start_filename = php_output_get_start_filename(TSRMLS_C);
+               int output_start_lineno = php_output_get_start_lineno(TSRMLS_C);
 
                if (output_start_filename) {
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot send session cookie - headers already sent by (output started at %s:%d)",
index 7d23ccf307b6d6088ed6588967c3b99fc246d784..60a450127130684cabc2c59f54d345c6c437bfd8 100644 (file)
@@ -1482,7 +1482,7 @@ PHP_METHOD(SoapServer, handle)
                }
        }
 
-       if (php_output_start_default() != SUCCESS) {
+       if (php_output_start_default(TSRMLS_C) != SUCCESS) {
                php_error_docref(NULL TSRMLS_CC, E_ERROR,"ob_start failed");
        }
 
@@ -1609,7 +1609,7 @@ PHP_METHOD(SoapServer, handle)
                                        php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error calling constructor");
                                }
                                if (EG(exception)) {
-                                       php_output_discard();
+                                       php_output_discard(TSRMLS_C);
                                        if (Z_TYPE_P(EG(exception)) == IS_OBJECT &&
                                            instanceof_function(Z_OBJCE_P(EG(exception)), soap_fault_class_entry TSRMLS_CC)) {
                                                soap_server_fault_ex(function, EG(exception), NULL TSRMLS_CC);
@@ -1642,7 +1642,7 @@ PHP_METHOD(SoapServer, handle)
                                        }
 #ifdef ZEND_ENGINE_2
                                        if (EG(exception)) {
-                                               php_output_discard();
+                                               php_output_discard(TSRMLS_C);
                                                if (Z_TYPE_P(EG(exception)) == IS_OBJECT &&
                                                    instanceof_function(Z_OBJCE_P(EG(exception)), soap_fault_class_entry TSRMLS_CC)) {
                                                        soap_server_fault_ex(function, EG(exception), NULL TSRMLS_CC);
@@ -1721,14 +1721,14 @@ PHP_METHOD(SoapServer, handle)
                                            Z_TYPE_PP(tmp) != IS_NULL) {
                                                headerfault = *tmp;
                                        }
-                                       php_output_discard();
+                                       php_output_discard(TSRMLS_C);
                                        soap_server_fault_ex(function, &h->retval, h TSRMLS_CC);
                                        efree(fn_name);
                                        if (soap_obj) {zval_ptr_dtor(&soap_obj);}
                                        goto fail;
 #ifdef ZEND_ENGINE_2
                                } else if (EG(exception)) {
-                                       php_output_discard();
+                                       php_output_discard(TSRMLS_C);
                                        if (Z_TYPE_P(EG(exception)) == IS_OBJECT &&
                                            instanceof_function(Z_OBJCE_P(EG(exception)), soap_fault_class_entry TSRMLS_CC)) {
                                                zval *headerfault = NULL, **tmp;
@@ -1774,7 +1774,7 @@ PHP_METHOD(SoapServer, handle)
 
 #ifdef ZEND_ENGINE_2
        if (EG(exception)) {
-               php_output_discard();
+               php_output_discard(TSRMLS_C);
                if (Z_TYPE_P(EG(exception)) == IS_OBJECT &&
                    instanceof_function(Z_OBJCE_P(EG(exception)), soap_fault_class_entry TSRMLS_CC)) {
                        soap_server_fault_ex(function, EG(exception), NULL TSRMLS_CC);
@@ -1794,7 +1794,7 @@ PHP_METHOD(SoapServer, handle)
 
                if (Z_TYPE(retval) == IS_OBJECT &&
                    instanceof_function(Z_OBJCE(retval), soap_fault_class_entry TSRMLS_CC)) {
-                       php_output_discard();
+                       php_output_discard(TSRMLS_C);
                        soap_server_fault_ex(function, &retval, NULL TSRMLS_CC);
                        goto fail;
                }
@@ -1815,7 +1815,7 @@ PHP_METHOD(SoapServer, handle)
        }
 
        /* Flush buffer */
-       php_output_discard();
+       php_output_discard(TSRMLS_C);
 
        if (doc_return) {
                /* xmlDocDumpMemoryEnc(doc_return, &buf, &size, XML_CHAR_ENCODING_UTF8); */
@@ -2083,11 +2083,11 @@ static void soap_error_handler(int error_num, const char *error_filename, const
                                code = "Server";
                        }
                        /* Get output buffer and send as fault detials */
-                       if (php_output_get_length(&outbuflen) != FAILURE && Z_LVAL(outbuflen) != 0) {
+                       if (php_output_get_length(&outbuflen TSRMLS_CC) != FAILURE && Z_LVAL(outbuflen) != 0) {
                                ALLOC_INIT_ZVAL(outbuf);
                                php_output_get_contents(outbuf TSRMLS_CC);
                        }
-                       php_output_discard();
+                       php_output_discard(TSRMLS_C);
 
                        INIT_ZVAL(fault_obj);
                        set_soap_fault(&fault_obj, NULL, code, buffer, NULL, outbuf, NULL TSRMLS_CC);
index 9756f6f683f879f8513cc3df01c635841509489e..8f6ee8ebaf79e241909dcd88af2f6944abdbf9d7 100644 (file)
@@ -2406,7 +2406,7 @@ PHP_FUNCTION(highlight_file)
        }
 
        if (i) {
-               php_output_start_default();
+               php_output_start_default(TSRMLS_C);
        }
 
        php_get_highlight_struct(&syntax_highlighter_ini);
@@ -2416,8 +2416,8 @@ PHP_FUNCTION(highlight_file)
        }
 
        if (i) {
-               php_output_get_contents(return_value);
-               php_output_discard();
+               php_output_get_contents(return_value TSRMLS_CC);
+               php_output_discard(TSRMLS_C);
        } else {
                RETURN_TRUE;
        }
@@ -2437,7 +2437,7 @@ PHP_FUNCTION(php_strip_whitespace)
                RETURN_FALSE;
        }
 
-       php_output_start_default();
+       php_output_start_default(TSRMLS_C);
 
        file_handle.type = ZEND_HANDLE_FILENAME;
        file_handle.filename = filename;
@@ -2453,8 +2453,8 @@ PHP_FUNCTION(php_strip_whitespace)
        zend_destroy_file_handle(&file_handle TSRMLS_CC);
        zend_restore_lexical_state(&original_lex_state TSRMLS_CC);
 
-       php_output_get_contents(return_value);
-       php_output_discard();
+       php_output_get_contents(return_value TSRMLS_CC);
+       php_output_discard(TSRMLS_C);
 
        return;
 }
@@ -2476,7 +2476,7 @@ PHP_FUNCTION(highlight_string)
        convert_to_string(expr);
 
        if (i) {
-               php_output_start_default();
+               php_output_start_default(TSRMLS_C);
        }
 
        EG(error_reporting) = E_ERROR;
@@ -2494,8 +2494,8 @@ PHP_FUNCTION(highlight_string)
        EG(error_reporting) = old_error_reporting;
 
        if (i) {
-               php_output_get_contents(return_value);
-               php_output_discard();
+               php_output_get_contents(return_value TSRMLS_CC);
+               php_output_discard(TSRMLS_C);
        } else {
                RETURN_TRUE;
        }
@@ -2739,14 +2739,14 @@ PHP_FUNCTION(print_r)
        }
        
        if (i) {
-               php_output_start_default();
+               php_output_start_default(TSRMLS_C);
        }
 
        zend_print_zval_r(var, 0 TSRMLS_CC);
 
        if (i) {
-               php_output_get_contents(return_value);
-               php_output_discard();
+               php_output_get_contents(return_value TSRMLS_CC);
+               php_output_discard(TSRMLS_C);
        } else {
                RETURN_TRUE;
        }
index 9754a2281f5b5b79eb9b52a0bda9a5b47cb94b8a..44c5611b58993b1118f22738db8ae1100f926e66 100644 (file)
@@ -200,8 +200,8 @@ PHP_FUNCTION(headers_sent)
                return;
 
        if (SG(headers_sent)) {
-               line = php_output_get_start_lineno();
-               file = php_output_get_start_filename();
+               line = php_output_get_start_lineno(TSRMLS_C);
+               file = php_output_get_start_filename(TSRMLS_C);
        }
 
        switch(ZEND_NUM_ARGS()) {
index 83da26918ed6ccf5d8963fdb907169bddfaa3ed7..b6ae535a98b603352a963ffdac3bc3dde27f700c 100644 (file)
@@ -999,9 +999,9 @@ PHP_FUNCTION(phpinfo)
        }
 
        /* Andale!  Andale!  Yee-Hah! */
-       php_output_start_default();
+       php_output_start_default(TSRMLS_C);
        php_print_info(flag TSRMLS_CC);
-       php_output_end();
+       php_output_end(TSRMLS_C);
 
        RETURN_TRUE;
 }
index 33208ca1462bb98f69d652e91d4ae5012a221593..f7807f25305896f867ca86b1d05ae9ee6d226a3b 100644 (file)
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.9.11 on Tue Feb 28 09:46:12 2006 */
+/* Generated by re2c 0.10.1 on Sat Jun  3 12:59:33 2006 */
 #line 1 "ext/standard/url_scanner_ex.re"
 /*
   +----------------------------------------------------------------------+
@@ -1035,11 +1035,15 @@ int php_url_scanner_add_var(char *name, int name_len, char *value, int value_len
        char *encoded;
        int encoded_len;
        smart_str val;
+       zval *ob_name;
        
        if (! BG(url_adapt_state_ex).active) {
+               MAKE_STD_ZVAL(ob_name);
+               ZVAL_ASCII_STRING(ob_name, "URL-Rewriter", ZSTR_DUPLICATE);
                php_url_scanner_ex_activate(TSRMLS_C);
-               php_output_start_internal("URL-Rewriter", php_url_scanner_output_handler, 0, PHP_OUTPUT_HANDLER_STDFLAGS);
+               php_output_start_internal(ob_name, php_url_scanner_output_handler, 0, PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC);
                BG(url_adapt_state_ex).active = 1;
+               zval_ptr_dtor(&ob_name);
        }
 
 
index 9593bbf6119e540052b8e70aeda45b3d223d0516..c079b808a9975068bc879fb55a3a65f447e53068 100644 (file)
@@ -450,11 +450,15 @@ int php_url_scanner_add_var(char *name, int name_len, char *value, int value_len
        char *encoded;
        int encoded_len;
        smart_str val;
+       zval *ob_name;
        
        if (! BG(url_adapt_state_ex).active) {
+               MAKE_STD_ZVAL(ob_name);
+               ZVAL_ASCII_STRING(ob_name, "URL-Rewriter", ZSTR_DUPLICATE);
                php_url_scanner_ex_activate(TSRMLS_C);
-               php_output_start_internal("URL-Rewriter", php_url_scanner_output_handler, 0, PHP_OUTPUT_HANDLER_STDFLAGS);
+               php_output_start_internal(ob_name, php_url_scanner_output_handler, 0, PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC);
                BG(url_adapt_state_ex).active = 1;
+               zval_ptr_dtor(&ob_name);
        }
 
 
index 9949f39822c4fe8d4e4114694dd1e26ee82e2d0f..39581a6f8e8de88c37f42d673493376026ca7982 100644 (file)
@@ -602,7 +602,7 @@ PHP_FUNCTION(var_export)
        }
        
        if (return_output) {
-               php_output_start_default();
+               php_output_start_default(TSRMLS_C);
        }
        
        /* UTODO
@@ -614,8 +614,8 @@ PHP_FUNCTION(var_export)
        php_var_export(&var, 1 TSRMLS_CC);
 
        if (return_output) {
-               php_output_get_contents(return_value);
-               php_output_discard();
+               php_output_get_contents(return_value TSRMLS_CC);
+               php_output_discard(TSRMLS_C);
        }
 }
 /* }}} */
index 86c46c57692778d01ab5a8deeb7e0aef37ecf44e..9e50361b61ea6c7f92078155ce27336a8b4a660d 100644 (file)
@@ -987,8 +987,8 @@ PHP_RINIT_FUNCTION(tidy)
        if (INI_BOOL("tidy.clean_output") == TRUE) {
                zval *name;
                MAKE_STD_ZVAL(name);
-               ZVAL_ASCII_STRINGL(name, "ob_tidyhandler", sizeof("ob_tidyhandler"), ZSTR_DUPLICATE);
-               if (php_output_start_user(name, 0, PHP_OUTPUT_HANDLER_STDFLAGS) == FAILURE) {
+               ZVAL_ASCII_STRINGL(name, "ob_tidyhandler", sizeof("ob_tidyhandler")-1, ZSTR_DUPLICATE);
+               if (php_output_start_user(name, 0, PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC) == FAILURE) {
                        zend_error(E_NOTICE, "Failure installing Tidy output buffering.");
                }
                zval_ptr_dtor(&name);
index ae82433240b589d12a8c86a5bd796216fe819d94..ba0b7007f3883be40d1a940c13553289e86da3a4 100644 (file)
@@ -219,7 +219,7 @@ PHP_MINIT_FUNCTION(zlib)
        php_stream_filter_register_factory("zlib.*", &php_zlib_filter_factory TSRMLS_CC);
        INIT_PZVAL(&tmp);
        ZVAL_ASCII_STRINGL(&tmp, "ob_gzhandler", sizeof("ob_gzhandler")-1, 0);
-       php_output_handler_conflict_register(&tmp, php_ob_gzhandler_check);
+       php_output_handler_conflict_register(&tmp, php_ob_gzhandler_check TSRMLS_CC);
 
        REGISTER_LONG_CONSTANT("FORCE_GZIP", CODING_GZIP, CONST_CS | CONST_PERSISTENT);
        REGISTER_LONG_CONSTANT("FORCE_DEFLATE", CODING_DEFLATE, CONST_CS | CONST_PERSISTENT);
@@ -835,30 +835,30 @@ PHP_FUNCTION(gzencode)
 int php_ob_gzhandler_check(zval *handler_name TSRMLS_DC)
 {
        /* check for wrong usages */
-       if (php_output_get_level() > 0) {
+       if (php_output_get_level(TSRMLS_C) > 0) {
                zval tmp;
                
-               if (php_output_handler_started(handler_name)) {
+               if (php_output_handler_started(handler_name TSRMLS_CC)) {
                        php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "output handler 'ob_gzhandler' cannot be used twice");
                        return FAILURE;
                }
                INIT_PZVAL(&tmp);
                ZVAL_ASCII_STRINGL(&tmp, "mb_output_handler", sizeof("mb_output_handler")-1, ZSTR_DUPLICATE);
-               if (php_output_handler_started(&tmp)) {
+               if (php_output_handler_started(&tmp TSRMLS_CC)) {
                        zval_dtor(&tmp);
                        php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "output handler 'ob_gzhandler' cannot be used after 'mb_output_handler'");
                        return FAILURE;
                }
                zval_dtor(&tmp);
                ZVAL_ASCII_STRINGL(&tmp, "URL-Reqriter", sizeof("URL-Rewriter")-1, ZSTR_DUPLICATE);
-               if (php_output_handler_started(&tmp)) {
+               if (php_output_handler_started(&tmp TSRMLS_CC)) {
                        zval_dtor(&tmp);
                        php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "output handler 'ob_gzhandler' cannot be used after 'URL-Rewriter'");
                        return FAILURE;
                }
                zval_dtor(&tmp);
                ZVAL_ASCII_STRINGL(&tmp, "zlib output compression", sizeof("zlib output compression")-1, ZSTR_DUPLICATE);
-               if (php_output_handler_conflict(handler_name, &tmp)) {
+               if (php_output_handler_conflict(handler_name, &tmp TSRMLS_CC)) {
                        zval_dtor(&tmp);
                        return FAILURE;
                }
@@ -907,7 +907,7 @@ PHP_FUNCTION(ob_gzhandler)
        
        if (ZLIBG(ob_gzhandler_status == -1)) {
                /* don't call this handler any more */
-               php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_DISABLE, NULL);
+               php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_DISABLE, NULL TSRMLS_CC);
                RETURN_FALSE;
        }
        
@@ -952,12 +952,12 @@ PHP_FUNCTION(ob_gzhandler)
 
        if (return_original) {
                /* don't call this handler any more */
-               php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_DISABLE, NULL);
+               php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_DISABLE, NULL TSRMLS_CC);
                /* return the original string */
                RETURN_STRINGL(string, string_len, 1);
        } else {
                /* don't allow cleaning and removing any longer */
-               php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE, NULL);
+               php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE, NULL TSRMLS_CC);
        }
 }
 /* }}} */
@@ -1006,13 +1006,13 @@ int php_enable_output_compression(int buffer_size TSRMLS_DC)
 
        MAKE_STD_ZVAL(output_handler);
        ZVAL_ASCII_STRINGL(output_handler, "zlib output compression", sizeof("zlib output compression")-1, ZSTR_DUPLICATE);
-       php_output_start_internal(output_handler, php_gzip_output_handler, buffer_size, PHP_OUTPUT_HANDLER_STDFLAGS);
+       php_output_start_internal(output_handler, php_gzip_output_handler, buffer_size, PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC);
        zval_ptr_dtor(&output_handler);
        
        if (ZLIBG(output_handler) && *ZLIBG(output_handler)) {
                MAKE_STD_ZVAL(output_handler);
                ZVAL_ASCII_STRING(output_handler, ZLIBG(output_handler), ZSTR_DUPLICATE);
-               php_output_start_user(output_handler, 0, PHP_OUTPUT_HANDLER_STDFLAGS);
+               php_output_start_user(output_handler, 0, PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC);
                zval_ptr_dtor(&output_handler);
        }
        return SUCCESS;
index 6b7e1ef4aefc3a9e83d1e6eff0850447fc489cf7..a1af14aa5b55c8f4184300f75af2bfa182482963 100644 (file)
@@ -553,8 +553,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC)
        int http_response_code;
        
        if (SG(headers_sent) && !SG(request_info).no_headers) {
-               char *output_start_filename = php_output_get_start_filename();
-               int output_start_lineno = php_output_get_start_lineno();
+               char *output_start_filename = php_output_get_start_filename(TSRMLS_C);
+               int output_start_lineno = php_output_get_start_lineno(TSRMLS_C);
 
                if (output_start_filename) {
                        sapi_module.sapi_error(E_WARNING, "Cannot modify header information - headers already sent by (output started at %s:%d)",
index b8fd867fa892e585d5b6e16c975ef52a0632a8e3..0454241b88efdacd73566d003985b3504db94e73 100644 (file)
@@ -232,10 +232,10 @@ static ZEND_INI_MH(OnUpdateOutputEncoding)
 }
 /* }}} */
 
-#define PHP_INI_OPTION_HEADERS_SENT(option_name)                                                                                                                       \
+#define PHP_INI_OPTION_HEADERS_SENT(option_name)                                                                                                                \
                if (SG(headers_sent)) {                                                                                                                                 \
-                       char *output_start_filename = php_output_get_start_filename();                                                                              \
-                       int output_start_lineno = php_output_get_start_lineno();                                                                                    \
+                       char *output_start_filename = php_output_get_start_filename(TSRMLS_C);                                                                              \
+                       int output_start_lineno = php_output_get_start_lineno(TSRMLS_C);                                                                                    \
                        if (output_start_filename) {                                                                                                                        \
                                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Option " #option_name " cannot be changed after headers have been sent (output started at %s:%d)", \
                                                                                                                                                                        output_start_filename, output_start_lineno);                                \
@@ -1175,7 +1175,7 @@ int php_request_startup(TSRMLS_D)
        zend_try {
                PG(during_request_startup) = 1;
 
-               php_output_activate();
+               php_output_activate(TSRMLS_C);
 
                /* initialize global variables */
                PG(modules_activated) = 0;
@@ -1205,12 +1205,12 @@ int php_request_startup(TSRMLS_D)
                        
                        MAKE_STD_ZVAL(oh);
                        ZVAL_ASCII_STRING(oh, PG(output_handler), ZSTR_DUPLICATE);
-                       php_output_start_user(oh, 0, PHP_OUTPUT_HANDLER_STDFLAGS);
+                       php_output_start_user(oh, 0, PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC);
                        zval_ptr_dtor(&oh);
                } else if (PG(output_buffering)) {
-                       php_output_start_user(NULL, PG(output_buffering) > 1 ? PG(output_buffering) : 0, PHP_OUTPUT_HANDLER_STDFLAGS);
+                       php_output_start_user(NULL, PG(output_buffering) > 1 ? PG(output_buffering) : 0, PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC);
                } else if (PG(implicit_flush)) {
-                       php_output_set_implicit_flush(1);
+                       php_output_set_implicit_flush(1 TSRMLS_CC);
                }
 
                /* We turn this off in php_execute_script() */
@@ -1240,7 +1240,7 @@ int php_request_startup(TSRMLS_D)
                return FAILURE;
        }
 
-       php_output_activate();
+       php_output_activate(TSRMLS_C);
        sapi_activate(TSRMLS_C);
        php_hash_environment(TSRMLS_C);
 
@@ -1272,7 +1272,7 @@ int php_request_startup_for_hook(TSRMLS_D)
                return FAILURE;
        }
 
-       php_output_activate();
+       php_output_activate(TSRMLS_C);
        sapi_activate_headers_only(TSRMLS_C);
        php_hash_environment(TSRMLS_C);
 
@@ -1366,11 +1366,11 @@ void php_request_shutdown(void *dummy)
        /* 3. Flush all output buffers */
        zend_try {
                if (SG(request_info).headers_only) {
-                       php_output_discard_all();
+                       php_output_discard_all(TSRMLS_C);
                } else {
-                       php_output_end_all();
+                       php_output_end_all(TSRMLS_C);
                }
-               php_output_deactivate();
+               php_output_deactivate(TSRMLS_C);
        } zend_end_try();
 
        /* 4. Send the set HTTP headers (note: This must be done AFTER php_end_ob_buffers() !!) */
@@ -1435,7 +1435,7 @@ void php_request_shutdown(void *dummy)
 static int php_output_wrapper(const char *str, uint str_length)
 {
        TSRMLS_FETCH();
-       return php_output_write(str, str_length);
+       return php_output_write(str, str_length TSRMLS_CC);
 }
 /* }}} */
 
@@ -1665,7 +1665,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
        REGISTER_MAIN_STRINGL_CONSTANT("PHP_EOL", PHP_EOL, sizeof(PHP_EOL)-1, CONST_PERSISTENT | CONST_CS);
        REGISTER_MAIN_LONG_CONSTANT("PHP_INT_MAX", LONG_MAX, CONST_PERSISTENT | CONST_CS);
        REGISTER_MAIN_LONG_CONSTANT("PHP_INT_SIZE", sizeof(long), CONST_PERSISTENT | CONST_CS);
-       php_output_register_constants();
+       php_output_register_constants(TSRMLS_C);
        php_rfc1867_register_constants(TSRMLS_C);
 
        if (php_startup_ticks(TSRMLS_C) == FAILURE) {
@@ -1946,7 +1946,7 @@ PHPAPI void php_handle_aborted_connection(void)
        TSRMLS_FETCH();
 
        PG(connection_status) = PHP_CONNECTION_ABORTED;
-       php_output_set_status(PHP_OUTPUT_DISABLED);
+       php_output_set_status(PHP_OUTPUT_DISABLED TSRMLS_CC);
 
        if (!PG(ignore_user_abort)) {
                zend_bailout();
index fcc9968fc73a5251c86e59bcc2e86faeb3fdeb58..a54a1dbe3371c2556431deaeead6c56f4501d9c0 100644 (file)
@@ -87,9 +87,9 @@ static inline void php_output_init_globals(zend_output_globals *G)
 PHPAPI void php_output_startup(void)
 {
        ZEND_INIT_MODULE_GLOBALS(output, php_output_init_globals, NULL);
-       zend_hash_init(&php_output_handler_aliases, 0, NULL, NULL, 1);
-       zend_hash_init(&php_output_handler_conflicts, 0, NULL, NULL, 1);
-       zend_hash_init(&php_output_handler_reverse_conflicts, 0, NULL, (void (*)(void *)) zend_hash_destroy, 1);
+       zend_u_hash_init(&php_output_handler_aliases, 0, NULL, NULL, 1, 1);
+       zend_u_hash_init(&php_output_handler_conflicts, 0, NULL, NULL, 1, 1);
+       zend_u_hash_init(&php_output_handler_reverse_conflicts, 0, NULL, (void (*)(void *)) zend_hash_destroy, 1, 1);
 }
 /* }}} */
 
@@ -105,7 +105,7 @@ PHPAPI void php_output_shutdown(void)
 
 /* {{{ SUCCESS|FAILURE php_output_activate(TSRMLS_D)
        Reset output globals and setup the output handler stack */
-PHPAPI int _php_output_activate(TSRMLS_D)
+PHPAPI int php_output_activate(TSRMLS_D)
 {
 #ifdef ZTS
        memset((*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(output_globals_id)], 0, sizeof(zend_output_globals));
@@ -125,9 +125,9 @@ PHPAPI int _php_output_activate(TSRMLS_D)
 }
 /* }}} */
 
-/* {{{ void php_output_deactivate(TSRMLS_D) 
+/* {{{ void php_output_deactivate(TSRMLS_D)
        Destroy the output handler stack */
-PHPAPI void _php_output_deactivate(TSRMLS_D)
+PHPAPI void php_output_deactivate(TSRMLS_D)
 {
        php_output_handler **handler = NULL;
        
@@ -135,7 +135,7 @@ PHPAPI void _php_output_deactivate(TSRMLS_D)
        OG(running) = NULL;
        /* release all output handlers */
        while (SUCCESS == zend_stack_top(&OG(handlers), (void *) &handler)) {
-               php_output_handler_free(handler);
+               php_output_handler_free(handler TSRMLS_CC);
                zend_stack_del_top(&OG(handlers));
        }
        zend_stack_destroy(&OG(handlers));
@@ -145,8 +145,8 @@ PHPAPI void _php_output_deactivate(TSRMLS_D)
 }
 /* }}} */
 
-/* {{{ void _php_output_register_constants() */
-PHPAPI void _php_output_register_constants(TSRMLS_D)
+/* {{{ void php_output_register_constants() */
+PHPAPI void php_output_register_constants(TSRMLS_D)
 {
        REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_START", PHP_OUTPUT_HANDLER_START, CONST_CS | CONST_PERSISTENT);
        REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_WRITE", PHP_OUTPUT_HANDLER_WRITE, CONST_CS | CONST_PERSISTENT);
@@ -164,17 +164,17 @@ PHPAPI void _php_output_register_constants(TSRMLS_D)
 }
 /* }}} */
 
-/* {{{ void php_output_set_status(int status)
+/* {{{ void php_output_set_status(int status TSRMLS_DC)
        Used by SAPIs to disable output */
-PHPAPI void _php_output_set_status(int status TSRMLS_DC)
+PHPAPI void php_output_set_status(int status TSRMLS_DC)
 {
        OG(flags) = status & 0xf;
 }
 /* }}} */
 
-/* {{{ int php_output_get_status()
+/* {{{ int php_output_get_status(TSRMLS_C)
        Get output control status */
-PHPAPI int _php_output_get_status(TSRMLS_D)
+PHPAPI int php_output_get_status(TSRMLS_D)
 {
        return OG(flags)
                        | (OG(active) ? PHP_OUTPUT_ACTIVE : 0)
@@ -182,23 +182,23 @@ PHPAPI int _php_output_get_status(TSRMLS_D)
 }
 /* }}} */
 
-/* {{{ zval *php_output_get_default_handler_name() */
-PHPAPI zval *_php_output_get_default_handler_name(TSRMLS_D)
+/* {{{ zval *php_output_get_default_handler_name(TSRMLS_C) */
+PHPAPI zval *php_output_get_default_handler_name(TSRMLS_D)
 {
        return OG(default_output_handler_name);
 }
 /* }}} */
 
-/* {{{ zval *php_output_get_devnull_handler_name() */
-PHPAPI zval *_php_output_get_devnull_handler_name(TSRMLS_D)
+/* {{{ zval *php_output_get_devnull_handler_name(TSRMLS_C) */
+PHPAPI zval *php_output_get_devnull_handler_name(TSRMLS_D)
 {
        return OG(devnull_output_handler_name);
 }
 /* }}} */
 
-/* {{{ int php_output_write_unbuffered(const char *str, size_t len)
+/* {{{ int php_output_write_unbuffered(const char *str, size_t len TSRMLS_DC)
        Unbuffered write */
-PHPAPI int _php_output_write_unbuffered(const char *str, size_t len TSRMLS_DC)
+PHPAPI int php_output_write_unbuffered(const char *str, size_t len TSRMLS_DC)
 {
        if (OG(flags) & PHP_OUTPUT_DISABLED) {
                return 0;
@@ -207,9 +207,56 @@ PHPAPI int _php_output_write_unbuffered(const char *str, size_t len TSRMLS_DC)
 }
 /* }}} */
 
-/* {{{ int php_output_write(const char *str, size_t len)
+/* {{{ int php_output_write_ascii(const char *str, size_t len TSRMLS_DC)
+       Buffered ASCII write */
+PHPAPI int php_output_write_ascii(const char *str, size_t len TSRMLS_DC)
+{
+       UErrorCode status = U_ZERO_ERROR;
+       char *buf_str = NULL;
+       int buf_len = 0;
+       
+       if (OG(flags) & PHP_OUTPUT_DISABLED) {
+               return 0;
+       }
+       
+       zend_convert_encodings(UG(output_encoding_conv), UG(ascii_conv),
+                       &buf_str, &buf_len, str, len, &status);
+       if (U_ZERO_ERROR == status) {
+               php_output_op(PHP_OUTPUT_HANDLER_WRITE, buf_str, buf_len TSRMLS_CC);
+       }
+       if (buf_str) {
+               efree(buf_str);
+       }
+       return (int) len;
+}
+/* }}} */
+
+/* {{{ int php_output_write_unicode(const UChar *str, size_t len TSRMLS_DC)
+       Buffered Unicode write */
+PHPAPI int php_output_write_unicode(const UChar *str, size_t len TSRMLS_DC)
+{
+       UErrorCode status = U_ZERO_ERROR;
+       char *buf_str = NULL;
+       int buf_len = 0;
+       
+       if (OG(flags) & PHP_OUTPUT_DISABLED) {
+               return 0;
+       }
+       
+       zend_convert_from_unicode(UG(output_encoding_conv), &buf_str, &buf_len, str, len, &status);
+       if (U_ZERO_ERROR == status) {
+               php_output_op(PHP_OUTPUT_HANDLER_WRITE, buf_str, buf_len TSRMLS_CC);
+       }
+       if (buf_str) {
+               efree(buf_str);
+       }
+       return (int) len;
+}
+/* }}} */
+
+/* {{{ int php_output_write(const char *str, size_t len TSRMLS_DC)
        Buffered write */
-PHPAPI int _php_output_write(const char *str, size_t len TSRMLS_DC)
+PHPAPI int php_output_write(const char *str, size_t len TSRMLS_DC)
 {
        if (OG(flags) & PHP_OUTPUT_DISABLED) {
                return 0;
@@ -219,9 +266,9 @@ PHPAPI int _php_output_write(const char *str, size_t len TSRMLS_DC)
 }
 /* }}} */
 
-/* {{{ void php_output_flush()
+/* {{{ void php_output_flush(TSRMLS_D)
        Flush the most recent output handlers buffer */
-PHPAPI void _php_output_flush(TSRMLS_D)
+PHPAPI void php_output_flush(TSRMLS_D)
 {
        php_output_context context;
        
@@ -230,7 +277,7 @@ PHPAPI void _php_output_flush(TSRMLS_D)
                php_output_handler_op(OG(active), &context);
                if (context.out.data && context.out.used) {
                        zend_stack_del_top(&OG(handlers));
-                       php_output_write(context.out.data, context.out.used);
+                       php_output_write(context.out.data, context.out.used TSRMLS_CC);
                        zend_stack_push(&OG(handlers), &OG(active), sizeof(php_output_handler *));
                }
                php_output_context_dtor(&context);
@@ -238,9 +285,9 @@ PHPAPI void _php_output_flush(TSRMLS_D)
 }
 /* }}} */
 
-/* {{{ void php_output_flush_all()
+/* {{{ void php_output_flush_all(TSRMLS_C)
        Flush all output buffers subsequently */
-PHPAPI void _php_output_flush_all(TSRMLS_D)
+PHPAPI void php_output_flush_all(TSRMLS_D)
 {
        if (OG(active)) {
                php_output_op(PHP_OUTPUT_HANDLER_FLUSH, NULL, 0 TSRMLS_CC);
@@ -248,9 +295,9 @@ PHPAPI void _php_output_flush_all(TSRMLS_D)
 }
 /* }}} */
 
-/* {{{ SUCCESS|FAILURE php_output_clean()
+/* {{{ SUCCESS|FAILURE php_output_clean(TSRMLS_D)
        Cleans the most recent output handlers buffer if the handler is cleanable */
-PHPAPI int _php_output_clean(TSRMLS_D)
+PHPAPI int php_output_clean(TSRMLS_D)
 {
        php_output_context context;
        
@@ -265,9 +312,9 @@ PHPAPI int _php_output_clean(TSRMLS_D)
 }
 /* }}} */
 
-/* {{{ void php_output_clean_all()
+/* {{{ void php_output_clean_all(TSRMLS_D)
        Cleans all output handler buffers, without regard whether the handler is cleanable */
-PHPAPI void _php_output_clean_all(TSRMLS_D)
+PHPAPI void php_output_clean_all(TSRMLS_D)
 {
        php_output_context context;
        
@@ -277,9 +324,9 @@ PHPAPI void _php_output_clean_all(TSRMLS_D)
        }
 }
 
-/* {{{ SUCCESS|FAILURE php_output_end()
+/* {{{ SUCCESS|FAILURE php_output_end(TSRMLS_D)
        Finalizes the most recent output handler at pops it off the stack if the handler is removable */
-PHPAPI int _php_output_end(TSRMLS_D)
+PHPAPI int php_output_end(TSRMLS_D)
 {
        if (php_output_stack_pop(0, 0 TSRMLS_CC)) {
                return SUCCESS;
@@ -288,17 +335,17 @@ PHPAPI int _php_output_end(TSRMLS_D)
 }
 /* }}} */
 
-/* {{{ void php_output_end_all()
+/* {{{ void php_output_end_all(TSRMLS_D)
        Finalizes all output handlers and ends output buffering without regard whether a handler is removable */
-PHPAPI void _php_output_end_all(TSRMLS_D)
+PHPAPI void php_output_end_all(TSRMLS_D)
 {
        while (OG(active) && php_output_stack_pop(0, 1 TSRMLS_CC));
 }
 /* }}} */
 
-/* {{{ SUCCESS|FAILURE php_output_discard()
+/* {{{ SUCCESS|FAILURE php_output_discard(TSRMLS_D)
        Discards the most recent output handlers buffer and pops it off the stack if the handler is removable */
-PHPAPI int _php_output_discard(TSRMLS_D)
+PHPAPI int php_output_discard(TSRMLS_D)
 {
        if (php_output_stack_pop(1, 0 TSRMLS_CC)) {
                return SUCCESS;
@@ -307,9 +354,9 @@ PHPAPI int _php_output_discard(TSRMLS_D)
 }
 /* }}} */
 
-/* {{{ void php_output_discard_all()
+/* {{{ void php_output_discard_all(TSRMLS_D)
        Discard all output handlers and buffers without regard whether a handler is removable */
-PHPAPI void _php_output_discard_all(TSRMLS_D)
+PHPAPI void php_output_discard_all(TSRMLS_D)
 {
        while (OG(active)) {
                php_output_stack_pop(1, 1 TSRMLS_CC);
@@ -317,17 +364,17 @@ PHPAPI void _php_output_discard_all(TSRMLS_D)
 }
 /* }}} */
 
-/* {{{ int php_output_get_level()
+/* {{{ int php_output_get_level(TSRMLS_D)
        Get output buffering level, ie. how many output handlers the stack contains */
-PHPAPI int _php_output_get_level(TSRMLS_D)
+PHPAPI int php_output_get_level(TSRMLS_D)
 {
        return OG(active) ? zend_stack_count(&OG(handlers)) : 0;
 }
 /* }}} */
 
-/* {{{ SUCCESS|FAILURE php_output_get_contents(zval *z)
+/* {{{ SUCCESS|FAILURE php_output_get_contents(zval *z TSRMLS_DC)
        Get the contents of the active output handlers buffer */
-PHPAPI int _php_output_get_contents(zval *p TSRMLS_DC)
+PHPAPI int php_output_get_contents(zval *p TSRMLS_DC)
 {
        if (OG(active)) {
                ZVAL_STRINGL(p, OG(active)->buffer.data, OG(active)->buffer.used, 1);
@@ -338,9 +385,9 @@ PHPAPI int _php_output_get_contents(zval *p TSRMLS_DC)
        }
 }
 
-/* {{{ SUCCESS|FAILURE php_output_get_length(zval *z)
+/* {{{ SUCCESS|FAILURE php_output_get_length(zval *z TSRMLS_DC)
        Get the length of the active output handlers buffer */
-PHPAPI int _php_output_get_length(zval *p TSRMLS_DC)
+PHPAPI int php_output_get_length(zval *p TSRMLS_DC)
 {
        if (OG(active)) {
                ZVAL_LONG(p, OG(active)->buffer.used);
@@ -352,74 +399,74 @@ PHPAPI int _php_output_get_length(zval *p TSRMLS_DC)
 }
 /* }}} */
 
-/* {{{ SUCCESS|FAILURE php_output_handler_start_default()
+/* {{{ SUCCESS|FAILURE php_output_handler_start_default(TSRMLS_D)
        Start a "default output handler" */
-PHPAPI int _php_output_start_default(TSRMLS_D)
+PHPAPI int php_output_start_default(TSRMLS_D)
 {
        php_output_handler *handler;
        
-       handler = php_output_handler_create_internal(OG(default_output_handler_name), php_output_handler_default_func, 0, PHP_OUTPUT_HANDLER_STDFLAGS);
-       if (SUCCESS == php_output_handler_start(handler)) {
+       handler = php_output_handler_create_internal(OG(default_output_handler_name), php_output_handler_default_func, 0, PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC);
+       if (SUCCESS == php_output_handler_start(handler TSRMLS_CC)) {
                return SUCCESS;
        }
-       php_output_handler_free(&handler);
+       php_output_handler_free(&handler TSRMLS_CC);
        return FAILURE;
 }
 /* }}} */
 
-/* {{{ SUCCESS|FAILURE php_output_handler_start_devnull()
+/* {{{ SUCCESS|FAILURE php_output_handler_start_devnull(TSRMLS_D)
        Start a "null output handler" */
-PHPAPI int _php_output_start_devnull(TSRMLS_D)
+PHPAPI int php_output_start_devnull(TSRMLS_D)
 {
        php_output_handler *handler;
        
-       handler = php_output_handler_create_internal(OG(devnull_output_handler_name), php_output_handler_devnull_func, PHP_OUTPUT_HANDLER_DEFAULT_SIZE, 0);
-       if (SUCCESS == php_output_handler_start(handler)) {
+       handler = php_output_handler_create_internal(OG(devnull_output_handler_name), php_output_handler_devnull_func, PHP_OUTPUT_HANDLER_DEFAULT_SIZE, 0 TSRMLS_CC);
+       if (SUCCESS == php_output_handler_start(handler TSRMLS_CC)) {
                return SUCCESS;
        }
-       php_output_handler_free(&handler);
+       php_output_handler_free(&handler TSRMLS_CC);
        return FAILURE;
 }
 /* }}} */
 
-/* {{{ SUCCESS|FAILURE php_output_start_user(zval *handler, size_t chunk_size, int flags)
+/* {{{ SUCCESS|FAILURE php_output_start_user(zval *handler, size_t chunk_size, int flags TSRMLS_DC)
        Start a user level output handler */
-PHPAPI int _php_output_start_user(zval *output_handler, size_t chunk_size, int flags TSRMLS_DC)
+PHPAPI int php_output_start_user(zval *output_handler, size_t chunk_size, int flags TSRMLS_DC)
 {
        php_output_handler *handler;
        
        if (output_handler) {
-               handler = php_output_handler_create_user(output_handler, chunk_size, flags);
+               handler = php_output_handler_create_user(output_handler, chunk_size, flags TSRMLS_CC);
        } else {
-               handler = php_output_handler_create_internal(OG(default_output_handler_name), php_output_handler_default_func, chunk_size, flags);
+               handler = php_output_handler_create_internal(OG(default_output_handler_name), php_output_handler_default_func, chunk_size, flags TSRMLS_CC);
        }
-       if (SUCCESS == php_output_handler_start(handler)) {
+       if (SUCCESS == php_output_handler_start(handler TSRMLS_CC)) {
                return SUCCESS;
        }
-       php_output_handler_free(&handler);
+       php_output_handler_free(&handler TSRMLS_CC);
        return FAILURE;
 }
 /* }}} */
 
-/* {{{ SUCCESS|FAILURE php_output_start_internal(const char *name, php_output_handler_func_t handler, size_t chunk_size, int flags)
+/* {{{ SUCCESS|FAILURE php_output_start_internal(zval *name, php_output_handler_func_t handler, size_t chunk_size, int flags TSRMLS_DC)
        Start an internal output handler that does not have to maintain a non-global state */
-PHPAPI int _php_output_start_internal(zval *name, php_output_handler_func_t output_handler, size_t chunk_size, int flags TSRMLS_DC)
+PHPAPI int php_output_start_internal(zval *name, php_output_handler_func_t output_handler, size_t chunk_size, int flags TSRMLS_DC)
 {
        php_output_handler *handler;
        
-       handler = php_output_handler_create_internal(name, php_output_handler_compat_func, chunk_size, flags);
-       php_output_handler_set_context(handler, output_handler, NULL);
-       if (SUCCESS == php_output_handler_start(handler)) {
+       handler = php_output_handler_create_internal(name, php_output_handler_compat_func, chunk_size, flags TSRMLS_CC);
+       php_output_handler_set_context(handler, output_handler, NULL TSRMLS_CC);
+       if (SUCCESS == php_output_handler_start(handler TSRMLS_CC)) {
                return SUCCESS;
        }
-       php_output_handler_free(&handler);
+       php_output_handler_free(&handler TSRMLS_CC);
        return FAILURE;
 }
 /* }}} */
 
-/* {{{ php_output_handler *php_output_handler_create_user(zval *handler, size_t chunk_size, int flags)
+/* {{{ php_output_handler *php_output_handler_create_user(zval *handler, size_t chunk_size, int flags TSRMLS_DC)
        Create a user level output handler */
-PHPAPI php_output_handler *_php_output_handler_create_user(zval *output_handler, size_t chunk_size, int flags TSRMLS_DC)
+PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler, size_t chunk_size, int flags TSRMLS_DC)
 {
        zval *handler_name = NULL;
        php_output_handler *handler = NULL;
@@ -430,8 +477,8 @@ PHPAPI php_output_handler *_php_output_handler_create_user(zval *output_handler,
                        break;
                case IS_STRING:
                case IS_UNICODE:
-                       if (Z_UNILEN_P(output_handler) && (internal = php_output_handler_alias(output_handler))) {
-                               return php_output_handler_create_internal(output_handler, *internal, chunk_size, flags);
+                       if (Z_UNILEN_P(output_handler) && (internal = php_output_handler_alias(output_handler TSRMLS_CC))) {
+                               return php_output_handler_create_internal(output_handler, *internal, chunk_size, flags TSRMLS_CC);
                        }
                default:
                        MAKE_STD_ZVAL(handler_name);
@@ -445,13 +492,13 @@ PHPAPI php_output_handler *_php_output_handler_create_user(zval *output_handler,
                        return handler;
        }
        
-       return php_output_handler_create_internal(OG(default_output_handler_name), php_output_handler_default_func, chunk_size, flags);
+       return php_output_handler_create_internal(OG(default_output_handler_name), php_output_handler_default_func, chunk_size, flags TSRMLS_CC);
 }
 /* }}} */
 
-/* {{{ php_output_handler *php_output_handler_create_internal(const char *name, php_output_handler_context_func_t handler, size_t chunk_size, int flags)
+/* {{{ php_output_handler *php_output_handler_create_internal(zval *name, php_output_handler_context_func_t handler, size_t chunk_size, int flags TSRMLS_DC)
        Create an internal output handler that can maintain a non-global state */
-PHPAPI php_output_handler *_php_output_handler_create_internal(zval *name, php_output_handler_context_func_t output_handler, size_t chunk_size, int flags TSRMLS_DC)
+PHPAPI php_output_handler *php_output_handler_create_internal(zval *name, php_output_handler_context_func_t output_handler, size_t chunk_size, int flags TSRMLS_DC)
 {
        php_output_handler *handler;
        
@@ -461,9 +508,9 @@ PHPAPI php_output_handler *_php_output_handler_create_internal(zval *name, php_o
        return handler;
 }
 
-/* {{{ void php_output_handler_set_context(php_output_handler *handler, void *opaq, void (*dtor)(void* TSRMLS_DC))
+/* {{{ void php_output_handler_set_context(php_output_handler *handler, void *opaq, void (*dtor)(void* TSRMLS_DC) TSRMLS_DC)
        Set the context/state of an output handler. Calls the dtor of the previous context if there is one */
-PHPAPI void _php_output_handler_set_context(php_output_handler *handler, void *opaq, void (*dtor)(void* TSRMLS_DC) TSRMLS_DC)
+PHPAPI void php_output_handler_set_context(php_output_handler *handler, void *opaq, void (*dtor)(void* TSRMLS_DC) TSRMLS_DC)
 {
        if (handler->dtor && handler->opaq) {
                handler->dtor(handler->opaq TSRMLS_CC);
@@ -473,9 +520,9 @@ PHPAPI void _php_output_handler_set_context(php_output_handler *handler, void *o
 }
 /* }}} */
 
-/* {{{ SUCCESS|FAILURE php_output_handler_start(php_output_handler *handler)
+/* {{{ SUCCESS|FAILURE php_output_handler_start(php_output_handler *handler TSRMLS_DC)
        Starts the set up output handler and pushes it on top of the stack. Checks for any conflicts regarding the output handler to start */
-PHPAPI int _php_output_handler_start(php_output_handler *handler TSRMLS_DC)
+PHPAPI int php_output_handler_start(php_output_handler *handler TSRMLS_DC)
 {
        HashTable *rconflicts;
        php_output_handler_conflict_check_t *conflict;
@@ -506,12 +553,12 @@ PHPAPI int _php_output_handler_start(php_output_handler *handler TSRMLS_DC)
 }
 /* }}} */
 
-/* {{{ int php_output_handler_started(const char *name)
+/* {{{ int php_output_handler_started(zval *name TSRMLS_DC)
        Check whether a certain output handler is in use */
-PHPAPI int _php_output_handler_started(zval *name TSRMLS_DC)
+PHPAPI int php_output_handler_started(zval *name TSRMLS_DC)
 {
        php_output_handler **handlers;
-       int i, count = php_output_get_level();
+       int i, count = php_output_get_level(TSRMLS_C);
        
        if (count) {
                handlers = *(php_output_handler ***) zend_stack_base(&OG(handlers));
@@ -527,11 +574,11 @@ PHPAPI int _php_output_handler_started(zval *name TSRMLS_DC)
 }
 /* }}} */
 
-/* {{{ int php_output_handler_conflict(const char *handler_new, const char *handler_old)
+/* {{{ int php_output_handler_conflict(zval *handler_new, zval *handler_old TSRMLS_DC)
        Check whether a certain handler is in use and issue a warning that the new handler would conflict with the already used one */
-PHPAPI int _php_output_handler_conflict(zval *handler_new, zval *handler_set TSRMLS_DC)
+PHPAPI int php_output_handler_conflict(zval *handler_new, zval *handler_set TSRMLS_DC)
 {
-       if (php_output_handler_started(handler_set)) {
+       if (php_output_handler_started(handler_set TSRMLS_CC)) {
                php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "output handler '%v' conflicts with '%v'", Z_UNIVAL_P(handler_new), Z_UNIVAL_P(handler_set));
                return 1;
        }
@@ -539,9 +586,9 @@ PHPAPI int _php_output_handler_conflict(zval *handler_new, zval *handler_set TSR
 }
 /* }}} */
 
-/* {{{ SUCCESS|FAILURE php_output_handler_conflict_register(const char name[], php_output_handler_conflict_check_t check_func)
+/* {{{ SUCCESS|FAILURE php_output_handler_conflict_register(zval *name, php_output_handler_conflict_check_t check_func TSRMLS_DC)
        Register a conflict checking function on MINIT */
-PHPAPI int _php_output_handler_conflict_register(zval *name, php_output_handler_conflict_check_t check_func TSRMLS_DC)
+PHPAPI int php_output_handler_conflict_register(zval *name, php_output_handler_conflict_check_t check_func TSRMLS_DC)
 {
        if (!EG(current_module)) {
                zend_error(E_ERROR, "Cannot register an output handler conflict outside of MINIT");
@@ -551,9 +598,9 @@ PHPAPI int _php_output_handler_conflict_register(zval *name, php_output_handler_
 }
 /* }}} */
 
-/* {{{ SUCCESS|FAILURE php_output_handler_reverse_conflict_register(const char name[], php_output_handler_conflict_check_t check_func)
+/* {{{ SUCCESS|FAILURE php_output_handler_reverse_conflict_register(zval *name, php_output_handler_conflict_check_t check_func TSRMLS_DC)
        Register a reverse conflict checking function on MINIT */
-PHPAPI int _php_output_handler_reverse_conflict_register(zval *name, php_output_handler_conflict_check_t check_func TSRMLS_DC)
+PHPAPI int php_output_handler_reverse_conflict_register(zval *name, php_output_handler_conflict_check_t check_func TSRMLS_DC)
 {
        HashTable rev, *rev_ptr = NULL;
        
@@ -564,7 +611,7 @@ PHPAPI int _php_output_handler_reverse_conflict_register(zval *name, php_output_
        if (SUCCESS == zend_u_hash_find(&php_output_handler_reverse_conflicts, Z_TYPE_P(name), Z_UNIVAL_P(name), Z_UNILEN_P(name), (void *) &rev_ptr)) {
                return zend_hash_next_index_insert(rev_ptr, &check_func, sizeof(php_output_handler_conflict_check_t *), NULL);
        } else {
-               zend_hash_init(&rev, 1, NULL, NULL, 1);
+               zend_u_hash_init(&rev, 1, NULL, NULL, 1, 1);
                if (SUCCESS != zend_hash_next_index_insert(&rev, &check_func, sizeof(php_output_handler_conflict_check_t *), NULL)) {
                        zend_hash_destroy(&rev);
                        return FAILURE;
@@ -578,9 +625,9 @@ PHPAPI int _php_output_handler_reverse_conflict_register(zval *name, php_output_
 }
 /* }}} */
 
-/* {{{ php_output_handler_context_func_t php_output_handler_alias(const char[] name)
+/* {{{ php_output_handler_context_func_t php_output_handler_alias(zval *name TSRMLS_DC)
        Get an internal output handler for a user handler if it exists */
-PHPAPI php_output_handler_context_func_t *_php_output_handler_alias(zval *name TSRMLS_DC)
+PHPAPI php_output_handler_context_func_t *php_output_handler_alias(zval *name TSRMLS_DC)
 {
        php_output_handler_context_func_t *func = NULL;
        
@@ -589,9 +636,9 @@ PHPAPI php_output_handler_context_func_t *_php_output_handler_alias(zval *name T
 }
 /* }}} */
 
-/* {{{ SUCCESS|FAILURE php_output_handler_alias_register(const char[] name, php_output_handler_context_func_t func)
-       Registers an internal output handler as alias for a user handler */
-PHPAPI int _php_output_handler_alias_register_ex(zval *name, php_output_handler_context_func_t func TSRMLS_DC)
+/* {{{ SUCCESS|FAILURE php_output_handler_alias_register(zval *name, php_output_handler_context_func_t func TSRMLS_DC)
++      Registers an internal output handler as alias for a user handler */
+PHPAPI int php_output_handler_alias_register_ex(zval *name, php_output_handler_context_func_t func TSRMLS_DC)
 {
        if (!EG(current_module)) {
                zend_error(E_ERROR, "Cannot register an output handler alias outside of MINIT");
@@ -601,9 +648,9 @@ PHPAPI int _php_output_handler_alias_register_ex(zval *name, php_output_handler_
 }
 /* }}} */
 
-/* {{{ SUCCESS|FAILURE php_output_handler_hook(int type, void *arg
+/* {{{ SUCCESS|FAILURE php_output_handler_hook(int type, void *arg TSMRLS_DC)
        Output handler hook for output handler functions to check/modify the current handlers abilities */
-PHPAPI int _php_output_handler_hook(int type, void *arg TSRMLS_DC)
+PHPAPI int php_output_handler_hook(int type, void *arg TSRMLS_DC)
 {
        if (OG(running)) {
                switch (type) {
@@ -625,9 +672,9 @@ PHPAPI int _php_output_handler_hook(int type, void *arg TSRMLS_DC)
 }
 /* }}} */
 
-/* {{{ void php_output_handler_dtor(php_output_handler *handler)
+/* {{{ void php_output_handler_dtor(php_output_handler *handler TSRMLS_DC)
        Destroy an output handler */
-PHPAPI void _php_output_handler_dtor(php_output_handler *handler TSRMLS_DC)
+PHPAPI void php_output_handler_dtor(php_output_handler *handler TSRMLS_DC)
 {
        zval_ptr_dtor(&handler->name);
        STR_FREE(handler->buffer.data);
@@ -641,21 +688,21 @@ PHPAPI void _php_output_handler_dtor(php_output_handler *handler TSRMLS_DC)
 }
 /* }}} */
 
-/* {{{ void php_output_handler_free(php_output_handler **handler)
+/* {{{ void php_output_handler_free(php_output_handler **handler TSMRLS_DC)
        Destroy and free an output handler */
-PHPAPI void _php_output_handler_free(php_output_handler **h TSRMLS_DC)
+PHPAPI void php_output_handler_free(php_output_handler **h TSRMLS_DC)
 {
        if (*h) {
-               php_output_handler_dtor(*h);
+               php_output_handler_dtor(*h TSRMLS_CC);
                efree(*h);
                *h = NULL;
        }
 }
 /* }}} */
 
-/* void php_output_set_implicit_flush(int enabled)
+/* void php_output_set_implicit_flush(int enabled TSRMLS_DC)
        Enable or disable implicit flush */
-PHPAPI void _php_output_set_implicit_flush(int flush TSRMLS_DC)
+PHPAPI void php_output_set_implicit_flush(int flush TSRMLS_DC)
 {
        if (flush) {
                OG(flags) |= PHP_OUTPUT_IMPLICITFLUSH;
@@ -665,17 +712,17 @@ PHPAPI void _php_output_set_implicit_flush(int flush TSRMLS_DC)
 }
 /* }}} */
 
-/* {{{ char *php_output_get_start_filename()
+/* {{{ char *php_output_get_start_filename(TSRMLS_D)
        Get the file name where output has started */
-PHPAPI char *_php_output_get_start_filename(TSRMLS_D)
+PHPAPI char *php_output_get_start_filename(TSRMLS_D)
 {
        return OG(output_start_filename);
 }
 /* }}} */
 
-/* {{{ int php_output_get_start_lineno()
+/* {{{ int php_output_get_start_lineno(TSRMLS_D)
        Get the line number where output has started */
-PHPAPI int _php_output_get_start_lineno(TSRMLS_D)
+PHPAPI int php_output_get_start_lineno(TSRMLS_D)
 {
        return OG(output_start_lineno);
 }
@@ -688,7 +735,7 @@ static inline int php_output_lock_error(int op TSRMLS_DC)
        /* if there's no ob active, ob has been stopped */
        if (op && OG(active) && OG(running)) {
                /* fatal error */
-               php_output_deactivate();
+               php_output_deactivate(TSRMLS_C);
                php_error_docref("ref.outcontrol" TSRMLS_CC, E_ERROR, "Cannot use output buffering in output buffering display handlers");
                return 1;
        }
@@ -1148,11 +1195,11 @@ static inline int php_output_stack_pop(int discard, int shutdown TSRMLS_DC)
                
                /* pass output along */
                if (context.out.data && context.out.used && !discard) {
-                       php_output_write(context.out.data, context.out.used);
+                       php_output_write(context.out.data, context.out.used TSRMLS_CC);
                }
                
                /* destroy the handler (after write!) */
-               php_output_handler_free(&orphan);
+               php_output_handler_free(&orphan TSRMLS_CC);
                php_output_context_dtor(&context);
                
                return 1;
@@ -1185,6 +1232,7 @@ static int php_output_handler_default_func(void **handler_context, php_output_co
        output_context->out.free = output_context->in.free;
        output_context->in.data = NULL;
        output_context->in.used = 0;
+       output_context->in.free = 0;
        return SUCCESS;
 }
 /* }}} */
@@ -1216,7 +1264,7 @@ PHP_FUNCTION(ob_start)
                chunk_size = 0;
        }
        
-       if (SUCCESS != php_output_start_user(output_handler, chunk_size, flags)) {
+       if (SUCCESS != php_output_start_user(output_handler, chunk_size, flags TSRMLS_CC)) {
                php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to create buffer.");
                RETURN_FALSE;
        }
@@ -1237,7 +1285,7 @@ PHP_FUNCTION(ob_flush)
                RETURN_FALSE;
        }
        
-       php_output_flush();
+       php_output_flush(TSRMLS_C);
        RETURN_TRUE;
 }
 /* }}} */
@@ -1255,7 +1303,7 @@ PHP_FUNCTION(ob_clean)
                php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer. No buffer to delete.");
                RETURN_FALSE;
        }
-       if (SUCCESS != php_output_clean()) {
+       if (SUCCESS != php_output_clean(TSRMLS_C)) {
                php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer %s.", OG(active)->name);
                RETURN_FALSE;
        }
@@ -1275,7 +1323,7 @@ PHP_FUNCTION(ob_end_flush)
                php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete and flush buffer. No buffer to delete or flush.");
                RETURN_FALSE;
        }
-       if (SUCCESS != php_output_end()) {
+       if (SUCCESS != php_output_end(TSRMLS_C)) {
                php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer %s.", OG(active)->name);
                RETURN_FALSE;
        }
@@ -1295,7 +1343,7 @@ PHP_FUNCTION(ob_end_clean)
                php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer. No buffer to delete.");
                RETURN_FALSE;
        }
-       if (SUCCESS != php_output_discard()) {
+       if (SUCCESS != php_output_discard(TSRMLS_C)) {
                php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer %s.", OG(active)->name);
                RETURN_FALSE;
        }
@@ -1311,11 +1359,11 @@ PHP_FUNCTION(ob_get_flush)
                ZEND_WRONG_PARAM_COUNT();
        }
        
-       if (SUCCESS != php_output_get_contents(return_value)) {
+       if (SUCCESS != php_output_get_contents(return_value TSRMLS_CC)) {
                php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete and flush buffer. No buffer to delete or flush.");
                RETURN_FALSE;
        }
-       if (SUCCESS != php_output_end()) {
+       if (SUCCESS != php_output_end(TSRMLS_C)) {
                php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer %s.", OG(active)->name);
        }
 }
@@ -1329,11 +1377,11 @@ PHP_FUNCTION(ob_get_clean)
                ZEND_WRONG_PARAM_COUNT();
        }
        
-       if (SUCCESS != php_output_get_contents(return_value)) {
+       if (SUCCESS != php_output_get_contents(return_value TSRMLS_CC)) {
                php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer. No buffer to delete.");
                RETURN_FALSE;
        }
-       if (SUCCESS != php_output_discard()) {
+       if (SUCCESS != php_output_discard(TSRMLS_C)) {
                php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer %s.", OG(active)->name);
        }
 }
@@ -1346,7 +1394,7 @@ PHP_FUNCTION(ob_get_contents)
        if (ZEND_NUM_ARGS()) {
                ZEND_WRONG_PARAM_COUNT();
        }
-       if (SUCCESS != php_output_get_contents(return_value)) {
+       if (SUCCESS != php_output_get_contents(return_value TSRMLS_CC)) {
                RETURN_FALSE;
        }
 }
@@ -1359,7 +1407,7 @@ PHP_FUNCTION(ob_get_level)
        if (ZEND_NUM_ARGS()) {
                ZEND_WRONG_PARAM_COUNT();
        }
-       RETURN_LONG(php_output_get_level());
+       RETURN_LONG(php_output_get_level(TSRMLS_C));
 }
 /* }}} */
 
@@ -1370,7 +1418,7 @@ PHP_FUNCTION(ob_get_length)
        if (ZEND_NUM_ARGS()) {
                ZEND_WRONG_PARAM_COUNT();
        }
-       if (SUCCESS != php_output_get_length(return_value)) {
+       if (SUCCESS != php_output_get_length(return_value TSRMLS_CC)) {
                RETURN_FALSE;
        }
 }
@@ -1422,7 +1470,7 @@ PHP_FUNCTION(ob_implicit_flush)
        long flag = 1;
        
        if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flag)) {
-               php_output_set_implicit_flush(flag);
+               php_output_set_implicit_flush(flag TSRMLS_CC);
        }
 }
 /* }}} */
index d7488f82160463a9c0027929b84516ec33654a62..cf27aca5a573a4df6bc949e7826b899c45eb13b4 100644 (file)
@@ -137,29 +137,29 @@ ZEND_END_MODULE_GLOBALS(output);
 #endif
 
 /* convenience macros */
-#define PHPWRITE(str, str_len)         php_output_write((str), (str_len))
-#define PHPWRITE_H(str, str_len)       php_output_write_unbuffered((str), (str_len))
+#define PHPWRITE(str, str_len)         php_output_write((str), (str_len) TSRMLS_CC)
+#define PHPWRITE_H(str, str_len)       php_output_write_unbuffered((str), (str_len) TSRMLS_CC)
 
-#define PUTC(c)                                                (php_output_write(&(c), 1), (c))
-#define PUTC_H(c)                                      (php_output_write_unbuffered(&(c), 1), (c))
+#define PUTC(c)                                                (php_output_write(&(c), 1 TSRMLS_CC), (c))
+#define PUTC_H(c)                                      (php_output_write_unbuffered(&(c), 1 TSRMLS_CC), (c))
 
 #define PUTS(str)                                      do {                            \
        const char *__str = (str);                                                      \
-       php_output_write(__str, strlen(__str));                         \
+       php_output_write(__str, strlen(__str) TSRMLS_CC);       \
 } while (0)
-#define PUTS_H(str)                                    do {                            \
-       const char *__str = (str);                                                      \
-       php_output_write_unbuffered(__str, strlen(__str));      \
+#define PUTS_H(str)                                    do {                                                    \
+       const char *__str = (str);                                                                              \
+       php_output_write_unbuffered(__str, strlen(__str) TSRMLS_CC);    \
 } while (0)
 
 
 BEGIN_EXTERN_C()
 #define php_output_tearup() \
        php_output_startup(); \
-       php_output_activate()
+       php_output_activate(TSRMLS_C)
 #define php_output_teardown() \
-       php_output_end_all(); \
-       php_output_deactivate(); \
+       php_output_end_all(TSRMLS_C); \
+       php_output_deactivate(TSRMLS_C); \
        php_output_shutdown()
 
 /* MINIT */
@@ -167,132 +167,62 @@ PHPAPI void php_output_startup(void);
 /* MSHUTDOWN */
 PHPAPI void php_output_shutdown(void);
 
-#define php_output_register_constants() _php_output_register_constants(TSRMLS_C)
-PHPAPI void _php_output_register_constants(TSRMLS_D);
+PHPAPI void php_output_register_constants(TSRMLS_D);
 
 /* RINIT */
-#define php_output_activate() _php_output_activate(TSRMLS_C)
-PHPAPI int _php_output_activate(TSRMLS_D);
+PHPAPI int php_output_activate(TSRMLS_D);
 /* RSHUTDOWN */
-#define php_output_deactivate() _php_output_deactivate(TSRMLS_C)
-PHPAPI void _php_output_deactivate(TSRMLS_D);
-
-
-#define php_output_get_default_handler_name() _php_output_get_default_handler_name(TSRMLS_C)
-PHPAPI zval *_php_output_get_default_handler_name(TSRMLS_D);
-
-#define php_output_get_devnull_handler_name() _php_output_get_devnull_handler_name(TSRMLS_C)
-PHPAPI zval *_php_output_get_devnull_handler_name(TSRMLS_D);
-
-
-#define php_output_set_status(s) _php_output_set_status((s) TSRMLS_CC)
-PHPAPI void _php_output_set_status(int status TSRMLS_DC);
-
-#define php_output_get_status() _php_output_get_status(TSRMLS_C)
-PHPAPI int _php_output_get_status(TSRMLS_D);
-
-#define php_output_write_unbuffered(s, l) _php_output_write_unbuffered((s), (l) TSRMLS_CC)
-PHPAPI int _php_output_write_unbuffered(const char *str, size_t len TSRMLS_DC);
-
-#define php_output_write(s, l) _php_output_write((s), (l) TSRMLS_CC)
-PHPAPI int _php_output_write(const char *str, size_t len TSRMLS_DC);
-
-#define php_output_flush() _php_output_flush(TSRMLS_C)
-PHPAPI void _php_output_flush(TSRMLS_D);
-
-#define php_output_flush_all() _php_output_flush_all(TSRMLS_C)
-PHPAPI void _php_output_flush_all(TSRMLS_D);
-
-#define php_output_clean() _php_output_clean(TSRMLS_C)
-PHPAPI int _php_output_clean(TSRMLS_D);
-
-#define php_output_clean_all() _php_output_clean_all(TSRMLS_C)
-PHPAPI void _php_output_clean_all(TSRMLS_D);
-
-#define php_output_end() _php_output_end(TSRMLS_C)
-PHPAPI int _php_output_end(TSRMLS_D);
-
-#define php_output_end_all() _php_output_end_all(TSRMLS_C)
-PHPAPI void _php_output_end_all(TSRMLS_D);
-
-#define php_output_discard() _php_output_discard(TSRMLS_C)
-PHPAPI int _php_output_discard(TSRMLS_D);
-
-#define php_output_discard_all() _php_output_discard_all(TSRMLS_C)
-PHPAPI void _php_output_discard_all(TSRMLS_D);
-
-
-#define php_output_get_contents(p) _php_output_get_contents((p) TSRMLS_CC)
-PHPAPI int _php_output_get_contents(zval *p TSRMLS_DC);
-
-#define php_output_get_length(p) _php_output_get_length((p) TSRMLS_CC)
-PHPAPI int _php_output_get_length(zval *TSRMLS_DC);
-
-#define php_output_get_level() _php_output_get_level(TSRMLS_C)
-PHPAPI int _php_output_get_level(TSRMLS_D);
-
-
-#define php_output_start_default() _php_output_start_default(TSRMLS_C)
-PHPAPI int _php_output_start_default(TSRMLS_D);
-
-#define php_output_start_devnull() _php_output_start_devnull(TSRMLS_C)
-PHPAPI int _php_output_start_devnull(TSRMLS_D);
-
-#define php_output_start_user(h, s, f) _php_output_start_user((h), (s), (f) TSRMLS_CC)
-PHPAPI int _php_output_start_user(zval *output_handler, size_t chunk_size, int flags TSRMLS_DC);
-
-#define php_output_start_internal(n, h, s, f) _php_output_start_internal((n), (h), (s), (f) TSRMLS_CC)
-PHPAPI int _php_output_start_internal(zval *name, php_output_handler_func_t output_handler, size_t chunk_size, int flags TSRMLS_DC);
-
-#define php_output_handler_create_user(h, s, f) _php_output_handler_create_user((h), (s), (f) TSRMLS_CC)
-PHPAPI php_output_handler *_php_output_handler_create_user(zval *handler, size_t chunk_size, int flags TSRMLS_DC);
-
-#define php_output_handler_create_internal(n, h, s, f) _php_output_handler_create_internal((n), (h), (s), (f) TSRMLS_CC)
-PHPAPI php_output_handler *_php_output_handler_create_internal(zval *name, php_output_handler_context_func_t handler, size_t chunk_size, int flags TSRMLS_DC);
-
-#define php_output_handler_set_context(h, c, d) _php_output_handler_set_context((h), (c), (d) TSRMLS_CC)
-PHPAPI void _php_output_handler_set_context(php_output_handler *handler, void *opaq, void (*dtor)(void* TSRMLS_DC) TSRMLS_DC);
-
-#define php_output_handler_start(h) _php_output_handler_start((h) TSRMLS_CC)
-PHPAPI int _php_output_handler_start(php_output_handler *handler TSRMLS_DC);
-
-#define php_output_handler_started(n) _php_output_handler_started((n) TSRMLS_CC)
-PHPAPI int _php_output_handler_started(zval *name TSRMLS_DC);
-
-#define php_output_handler_hook(t, a) _php_output_handler_hook((t), (a) TSRMLS_CC)
-PHPAPI int _php_output_handler_hook(int type, void *arg TSRMLS_DC);
-
-#define php_output_handler_dtor(h) _php_output_handler_dtor((h) TSRMLS_CC)
-PHPAPI void _php_output_handler_dtor(php_output_handler *handler TSRMLS_DC);
-
-#define php_output_handler_free(h) _php_output_handler_free((h) TSRMLS_CC)
-PHPAPI void _php_output_handler_free(php_output_handler **handler TSRMLS_DC);
-
-
-#define php_output_set_implicit_flush(f) _php_output_set_implicit_flush((f) TSRMLS_CC)
-PHPAPI void _php_output_set_implicit_flush(int flush TSRMLS_DC);
-
-#define php_output_get_start_filename() _php_output_get_start_filename(TSRMLS_C)
-PHPAPI char *_php_output_get_start_filename(TSRMLS_D);
-
-#define php_output_get_start_lineno() _php_output_get_start_lineno(TSRMLS_C)
-PHPAPI int _php_output_get_start_lineno(TSRMLS_D);
-
-
-#define php_output_handler_conflict(n, s) _php_output_handler_conflict((n), (s) TSRMLS_CC)
-PHPAPI int _php_output_handler_conflict(zval *handler_new, zval *handler_set TSRMLS_DC);
-
-#define php_output_handler_conflict_register(n, f) _php_output_handler_conflict_register((n), (f) TSRMLS_CC)
-PHPAPI int _php_output_handler_conflict_register(zval *handler_name, php_output_handler_conflict_check_t check_func TSRMLS_DC);
-
-#define php_output_handler_reverse_conflict_register(n, f) _php_output_handler_reverse_conflict_register((n), (f) TSRMLS_CC)
-PHPAPI int _php_output_handler_reverse_conflict_register(zval *handler_name, php_output_handler_conflict_check_t check_func TSRMLS_DC);
-
-#define php_output_handler_alias(n) _php_output_handler_alias((n) TSRMLS_CC)
-PHPAPI php_output_handler_context_func_t *_php_output_handler_alias(zval *handler_name TSRMLS_DC);
-
-#define php_output_handler_alias_register(n, f) _php_output_handler_alias_register((n), (f) TSRMLS_CC)
-PHPAPI int _php_output_handler_alias_register(zval *handler_name, php_output_handler_context_func_t func TSRMLS_DC);
+PHPAPI void php_output_deactivate(TSRMLS_D);
+
+PHPAPI zval *php_output_get_default_handler_name(TSRMLS_D);
+PHPAPI zval *php_output_get_devnull_handler_name(TSRMLS_D);
+
+PHPAPI void php_output_set_status(int status TSRMLS_DC);
+PHPAPI int php_output_get_status(TSRMLS_D);
+PHPAPI void php_output_set_implicit_flush(int flush TSRMLS_DC);
+PHPAPI char *php_output_get_start_filename(TSRMLS_D);
+PHPAPI int php_output_get_start_lineno(TSRMLS_D);
+
+PHPAPI int php_output_write_unbuffered(const char *str, size_t len TSRMLS_DC);
+PHPAPI int php_output_write_unicode(const UChar *str, size_t len TSRMLS_DC);
+PHPAPI int php_output_write_ascii(const char *str, size_t len TSRMLS_DC);
+PHPAPI int php_output_write(const char *str, size_t len TSRMLS_DC);
+
+PHPAPI void php_output_flush(TSRMLS_D);
+PHPAPI void php_output_flush_all(TSRMLS_D);
+PHPAPI int php_output_clean(TSRMLS_D);
+PHPAPI void php_output_clean_all(TSRMLS_D);
+PHPAPI int php_output_end(TSRMLS_D);
+PHPAPI void php_output_end_all(TSRMLS_D);
+PHPAPI int php_output_discard(TSRMLS_D);
+PHPAPI void php_output_discard_all(TSRMLS_D);
+
+PHPAPI int php_output_get_contents(zval *p TSRMLS_DC);
+PHPAPI int php_output_get_length(zval *TSRMLS_DC);
+PHPAPI int php_output_get_level(TSRMLS_D);
+
+PHPAPI int php_output_start_default(TSRMLS_D);
+PHPAPI int php_output_start_devnull(TSRMLS_D);
+
+PHPAPI int php_output_start_user(zval *output_handler, size_t chunk_size, int flags TSRMLS_DC);
+PHPAPI int php_output_start_internal(zval *name, php_output_handler_func_t output_handler, size_t chunk_size, int flags TSRMLS_DC);
+
+PHPAPI php_output_handler *php_output_handler_create_user(zval *handler, size_t chunk_size, int flags TSRMLS_DC);
+PHPAPI php_output_handler *php_output_handler_create_internal(zval *name, php_output_handler_context_func_t handler, size_t chunk_size, int flags TSRMLS_DC);
+
+PHPAPI void php_output_handler_set_context(php_output_handler *handler, void *opaq, void (*dtor)(void* TSRMLS_DC) TSRMLS_DC);
+PHPAPI int php_output_handler_start(php_output_handler *handler TSRMLS_DC);
+PHPAPI int php_output_handler_started(zval *name TSRMLS_DC);
+PHPAPI int php_output_handler_hook(int type, void *arg TSRMLS_DC);
+PHPAPI void php_output_handler_dtor(php_output_handler *handler TSRMLS_DC);
+PHPAPI void php_output_handler_free(php_output_handler **handler TSRMLS_DC);
+
+PHPAPI int php_output_handler_conflict(zval *handler_new, zval *handler_set TSRMLS_DC);
+PHPAPI int php_output_handler_conflict_register(zval *handler_name, php_output_handler_conflict_check_t check_func TSRMLS_DC);
+PHPAPI int php_output_handler_reverse_conflict_register(zval *handler_name, php_output_handler_conflict_check_t check_func TSRMLS_DC);
+
+PHPAPI php_output_handler_context_func_t *php_output_handler_alias(zval *handler_name TSRMLS_DC);
+PHPAPI int php_output_handler_alias_register(zval *handler_name, php_output_handler_context_func_t func TSRMLS_DC);
 
 END_EXTERN_C()
 
index e9b853a4ad0266a54659c0e807ad58a09554fe2e..6d7c95e3eb6d57a33182ca11bfa11193dccbfc2f 100644 (file)
@@ -315,7 +315,7 @@ static void php_apache_request_shutdown(void *dummy)
 {
        TSRMLS_FETCH();
 
-       php_output_set_status(PHP_OUTPUT_DISABLED);
+       php_output_set_status(PHP_OUTPUT_DISABLED TSRMLS_CC);
        if (AP(in_request)) {
                AP(in_request) = 0;
                php_request_shutdown(dummy);
index 517ef6df11f3d5943c2cdb6b6a0aee6c6860074b..63a9aafe35b62b8b9c11e5eb023a30a3576fe721 100644 (file)
@@ -93,7 +93,7 @@ PHP_FUNCTION(virtual)
        }
 
        /* Flush everything. */
-       php_output_end_all();
+       php_output_end_all(TSRMLS_C);
        php_header(TSRMLS_C);
 
        /* Ensure that the ap_r* layer for the main request is flushed, to
index 558274d5da6bd80dba67e75bc321633011d24d87..2771e1263897d72dccc1e10b81e90f7a04390fee 100644 (file)
@@ -434,7 +434,7 @@ static void php_apache_request_shutdown(void *dummy)
 {
        TSRMLS_FETCH();
        AP(current_hook) = AP_CLEANUP;
-       php_output_set_status(PHP_OUTPUT_DISABLED);
+       php_output_set_status(PHP_OUTPUT_DISABLED TSRMLS_CC);
        SG(server_context) = NULL; /* The server context (request) is invalid by the time run_cleanups() is called */
        if(SG(sapi_started)) {
                php_request_shutdown(dummy);
index 3deaab28046298a95e767b15bd7658308c4759ac..6658907315da9bcb54ce4cedcb01cf59432277fb 100644 (file)
@@ -719,7 +719,7 @@ int main(int argc, char *argv[])
                                        goto err;
                                }
                                php_cli_usage(argv[0]);
-                               php_output_end_all();
+                               php_output_end_all(TSRMLS_C);
                                exit_status=0;
                                goto out;
 
@@ -728,7 +728,7 @@ int main(int argc, char *argv[])
                                        goto err;
                                }
                                php_print_info(0xFFFFFFFF TSRMLS_CC);
-                               php_output_end_all();
+                               php_output_end_all(TSRMLS_C);
                                exit_status=0;
                                goto out;
 
@@ -741,7 +741,7 @@ int main(int argc, char *argv[])
                                php_printf("\n[Zend Modules]\n");
                                print_extensions(TSRMLS_C);
                                php_printf("\n");
-                               php_output_end_all();
+                               php_output_end_all(TSRMLS_C);
                                exit_status=0;
                                goto out;
 
@@ -763,7 +763,7 @@ int main(int argc, char *argv[])
 #endif
                                        get_zend_version()
                                );
-                               php_output_end_all();
+                               php_output_end_all(TSRMLS_C);
                                exit_status=0;
                                goto out;
 
index 454020713fe93c26e5e92a47a5bc8f9d1c0df092..5434d93cd61de06f7331a4e0866bec3585a933a3 100644 (file)
@@ -347,7 +347,7 @@ PHP_FUNCTION(nsapi_virtual)
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include uri '%s' - Sub-requests do not work with zlib.output_compression", (*uri)->value.str.val);
                RETURN_FALSE;
        } else {
-               php_output_end_all();
+               php_output_end_all(TSRMLS_C);
                php_header(TSRMLS_C);
 
                /* do the sub-request */