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

This commit is contained in:
Kalle Sommer Nielsen 2013-12-18 09:06:39 +01:00
parent f70f89c1b1
commit ed5a8d510f
14 changed files with 15 additions and 23 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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.

View File

@ -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;

View File

@ -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();

View File

@ -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) {

View File

@ -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) {

View File

@ -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 */

View File

@ -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 */