Commit:    ed5a8d510f6e4ae865008fe711efbbc5452adf42
Author:    Kalle Sommer Nielsen <ka...@php.net>         Wed, 18 Dec 2013 
09:06:39 +0100
Parents:   f70f89c1b1e0bbd2b2b6940bb0a4e12a2be07770
Branches:  master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=ed5a8d510f6e4ae865008fe711efbbc5452adf42

Log:
Pass the TSRMLS parameters to the sapi flush hook, this shaves off a few 
TSRMLS_FETCH() calls in our various SAPIs

Changed paths:
  M  main/SAPI.c
  M  main/SAPI.h
  M  sapi/apache/mod_php5.c
  M  sapi/apache2filter/sapi_apache2.c
  M  sapi/apache2handler/sapi_apache2.c
  M  sapi/apache_hooks/mod_php5.c
  M  sapi/cgi/cgi_main.c
  M  sapi/cli/php_cli.c
  M  sapi/cli/php_cli_server.c
  M  sapi/embed/php_embed.c
  M  sapi/fpm/fpm/fpm_main.c
  M  sapi/litespeed/lsapi_main.c
  M  sapi/milter/php_milter.c
  M  sapi/nsapi/nsapi.c


Diff:
diff --git a/main/SAPI.c b/main/SAPI.c
index c9ba5d5..4cdb6f9 100644
--- a/main/SAPI.c
+++ b/main/SAPI.c
@@ -992,7 +992,7 @@ SAPI_API int sapi_register_input_filter(unsigned int 
(*input_filter)(int arg, ch
 SAPI_API int sapi_flush(TSRMLS_D)
 {
        if (sapi_module.flush) {
-               sapi_module.flush(SG(server_context));
+               sapi_module.flush(SG(server_context) TSRMLS_CC);
                return SUCCESS;
        } else {
                return FAILURE;
diff --git a/main/SAPI.h b/main/SAPI.h
index 928fca9..3097cf1 100644
--- a/main/SAPI.h
+++ b/main/SAPI.h
@@ -227,7 +227,7 @@ struct _sapi_module_struct {
        int (*deactivate)(TSRMLS_D);
 
        int (*ub_write)(const char *str, unsigned int str_length TSRMLS_DC);
-       void (*flush)(void *server_context);
+       void (*flush)(void *server_context TSRMLS_DC);
        struct stat *(*get_stat)(TSRMLS_D);
        char *(*getenv)(char *name, size_t name_len TSRMLS_DC);
 
diff --git a/sapi/apache/mod_php5.c b/sapi/apache/mod_php5.c
index 8361f7f..2803903 100644
--- a/sapi/apache/mod_php5.c
+++ b/sapi/apache/mod_php5.c
@@ -108,7 +108,7 @@ static int sapi_apache_ub_write(const char *str, uint 
str_length TSRMLS_DC)
 
 /* {{{ sapi_apache_flush
  */
-static void sapi_apache_flush(void *server_context)
+static void sapi_apache_flush(void *server_context TSRMLS_DC)
 {
        if (server_context) {
 #if MODULE_MAGIC_NUMBER > 19970110
diff --git a/sapi/apache2filter/sapi_apache2.c 
b/sapi/apache2filter/sapi_apache2.c
index 8ce490e..c992c1c 100644
--- a/sapi/apache2filter/sapi_apache2.c
+++ b/sapi/apache2filter/sapi_apache2.c
@@ -245,14 +245,13 @@ php_apache_sapi_register_variables(zval *track_vars_array 
TSRMLS_DC)
 }
 
 static void
-php_apache_sapi_flush(void *server_context)
+php_apache_sapi_flush(void *server_context TSRMLS_DC)
 {
        php_struct *ctx;
        apr_bucket_brigade *bb;
        apr_bucket_alloc_t *ba;
        apr_bucket *b;
        ap_filter_t *f; /* output filters */
-       TSRMLS_FETCH();
 
        ctx = server_context;
 
diff --git a/sapi/apache2handler/sapi_apache2.c 
b/sapi/apache2handler/sapi_apache2.c
index b7f95e0..cf1a83f 100644
--- a/sapi/apache2handler/sapi_apache2.c
+++ b/sapi/apache2handler/sapi_apache2.c
@@ -287,11 +287,10 @@ php_apache_sapi_register_variables(zval *track_vars_array 
TSRMLS_DC)
 }
 
 static void
-php_apache_sapi_flush(void *server_context)
+php_apache_sapi_flush(void *server_context TSRMLS_DC)
 {
        php_struct *ctx;
        request_rec *r;
-       TSRMLS_FETCH();
 
        ctx = server_context;
 
diff --git a/sapi/apache_hooks/mod_php5.c b/sapi/apache_hooks/mod_php5.c
index 66adb48..4827932 100644
--- a/sapi/apache_hooks/mod_php5.c
+++ b/sapi/apache_hooks/mod_php5.c
@@ -253,7 +253,7 @@ static int sapi_apache_ub_write(const char *str, uint 
str_length TSRMLS_DC)
 
 /* {{{ sapi_apache_flush
  */
-static void sapi_apache_flush(void *server_context)
+static void sapi_apache_flush(void *server_context TSRMLS_DC)
 {
        if (server_context) {
 #if MODULE_MAGIC_NUMBER > 19970110
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 66ecce6..6fc5a86 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -324,14 +324,14 @@ static int sapi_fcgi_ub_write(const char *str, uint 
str_length TSRMLS_DC)
        return str_length;
 }
 
-static void sapi_cgi_flush(void *server_context)
+static void sapi_cgi_flush(void *server_context TSRMLS_DC)
 {
        if (fflush(stdout) == EOF) {
                php_handle_aborted_connection();
        }
 }
 
-static void sapi_fcgi_flush(void *server_context)
+static void sapi_fcgi_flush(void *server_context TSRMLS_DC)
 {
        fcgi_request *request = (fcgi_request*) server_context;
 
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index 2fd3dbe..cb52cd7 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -320,7 +320,7 @@ static int sapi_cli_ub_write(const char *str, uint 
str_length TSRMLS_DC) /* {{{
 }
 /* }}} */
 
-static void sapi_cli_flush(void *server_context) /* {{{ */
+static void sapi_cli_flush(void *server_context TSRMLS_DC) /* {{{ */
 {
        /* Ignore EBADF here, it's caused by the fact that STDIN/STDOUT/STDERR 
streams
         * are/could be closed before fflush() is called.
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index 77e4d09..89f20f6 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -614,10 +614,9 @@ static int sapi_cli_server_ub_write(const char *str, uint 
str_length TSRMLS_DC)
        return php_cli_server_client_send_through(client, str, str_length);
 } /* }}} */
 
-static void sapi_cli_server_flush(void *server_context) /* {{{ */
+static void sapi_cli_server_flush(void *server_context TSRMLS_DC) /* {{{ */
 {
        php_cli_server_client *client = server_context;
-       TSRMLS_FETCH();
 
        if (!client) {
                return;
diff --git a/sapi/embed/php_embed.c b/sapi/embed/php_embed.c
index 414b4db..66961ec 100644
--- a/sapi/embed/php_embed.c
+++ b/sapi/embed/php_embed.c
@@ -79,7 +79,7 @@ static int php_embed_ub_write(const char *str, uint 
str_length TSRMLS_DC)
        return str_length;
 }
 
-static void php_embed_flush(void *server_context)
+static void php_embed_flush(void *server_context TSRMLS_DC)
 {
        if (fflush(stdout)==EOF) {
                php_handle_aborted_connection();
diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c
index 91abfea..e1c8ff0 100644
--- a/sapi/fpm/fpm/fpm_main.c
+++ b/sapi/fpm/fpm/fpm_main.c
@@ -315,7 +315,7 @@ static int sapi_cgibin_ub_write(const char *str, uint 
str_length TSRMLS_DC)
 }
 
 
-static void sapi_cgibin_flush(void *server_context)
+static void sapi_cgibin_flush(void *server_context TSRMLS_DC)
 {
        /* fpm has started, let use fcgi instead of stdout */
        if (fpm_is_running) {
diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c
index 1626dcb..850433d 100644
--- a/sapi/litespeed/lsapi_main.c
+++ b/sapi/litespeed/lsapi_main.c
@@ -157,7 +157,7 @@ static int sapi_lsapi_ub_write(const char *str, uint 
str_length TSRMLS_DC)
 
 /* {{{ sapi_lsapi_flush
  */
-static void sapi_lsapi_flush( void * server_context )
+static void sapi_lsapi_flush( void * server_context TSRMLS_DC )
 {
     if ( lsapi_mode ) {
         if ( LSAPI_Flush() == -1) {
diff --git a/sapi/milter/php_milter.c b/sapi/milter/php_milter.c
index 7e8662f..f0ce1b0 100644
--- a/sapi/milter/php_milter.c
+++ b/sapi/milter/php_milter.c
@@ -860,10 +860,6 @@ static int sapi_milter_ub_write(const char *str, uint 
str_length TSRMLS_DC)
        return str_length;
 }
 
-static void sapi_milter_flush(void *server_context)
-{
-}
-
 static void sapi_milter_register_variables(zval *track_vars_array TSRMLS_DC)
 {
        php_register_variable ("SERVER_SOFTWARE", "Sendmail Milter", 
track_vars_array TSRMLS_CC);
@@ -906,7 +902,7 @@ static sapi_module_struct milter_sapi_module = {
        NULL,                                                   /* deactivate */
 
        sapi_milter_ub_write,                   /* unbuffered write */
-       sapi_milter_flush,                              /* flush */
+       NULL,                                                   /* flush */
        NULL,                                                   /* get uid */
        NULL,                                                   /* getenv */
 
diff --git a/sapi/nsapi/nsapi.c b/sapi/nsapi/nsapi.c
index 1e6a680..ee0f4b0 100644
--- a/sapi/nsapi/nsapi.c
+++ b/sapi/nsapi/nsapi.c
@@ -467,10 +467,9 @@ static int sapi_nsapi_ub_write(const char *str, unsigned 
int str_length TSRMLS_D
 }
 
 /* modified version of apache2 */
-static void sapi_nsapi_flush(void *server_context)
+static void sapi_nsapi_flush(void *server_context TSRMLS_DC)
 {
        nsapi_request_context *rc = (nsapi_request_context *)server_context;
-       TSRMLS_FETCH();
        
        if (!rc) {
                /* we have no context, so no flushing needed. This fixes a 
SIGSEGV on shutdown */


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to