mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
Eliminate some TSRMLS_FETCH() calls. Tested with Win32 build of SAPI/CGI and SAPI/CLI on Win32.
This commit is contained in:
parent
b671380b6b
commit
5ca078779a
@ -103,7 +103,7 @@ static int ftp_type(ftpbuf_t *ftp, ftptype_t type);
|
||||
static databuf_t* ftp_getdata(ftpbuf_t *ftp TSRMLS_DC);
|
||||
|
||||
/* accepts the data connection, returns updated data buffer */
|
||||
static databuf_t* data_accept(databuf_t *data, ftpbuf_t *ftp);
|
||||
static databuf_t* data_accept(databuf_t *data, ftpbuf_t *ftp TSRMLS_DC);
|
||||
|
||||
/* closes the data connection, returns NULL */
|
||||
static databuf_t* data_close(ftpbuf_t *ftp, databuf_t *data);
|
||||
@ -790,7 +790,7 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type,
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if ((data = data_accept(data, ftp)) == NULL) {
|
||||
if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) {
|
||||
goto bail;
|
||||
}
|
||||
|
||||
@ -874,7 +874,7 @@ ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, i
|
||||
if (!ftp_getresp(ftp) || (ftp->resp != 150 && ftp->resp != 125)) {
|
||||
goto bail;
|
||||
}
|
||||
if ((data = data_accept(data, ftp)) == NULL) {
|
||||
if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) {
|
||||
goto bail;
|
||||
}
|
||||
|
||||
@ -1469,14 +1469,13 @@ bail:
|
||||
/* {{{ data_accept
|
||||
*/
|
||||
databuf_t*
|
||||
data_accept(databuf_t *data, ftpbuf_t *ftp)
|
||||
data_accept(databuf_t *data, ftpbuf_t *ftp TSRMLS_DC)
|
||||
{
|
||||
php_sockaddr_storage addr;
|
||||
socklen_t size;
|
||||
|
||||
#if HAVE_OPENSSL_EXT
|
||||
SSL_CTX *ctx;
|
||||
TSRMLS_FETCH();
|
||||
#endif
|
||||
|
||||
if (data->fd != -1) {
|
||||
@ -1603,7 +1602,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
}
|
||||
|
||||
/* pull data buffer into tmpfile */
|
||||
if ((data = data_accept(data, ftp)) == NULL) {
|
||||
if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) {
|
||||
goto bail;
|
||||
}
|
||||
size = 0;
|
||||
@ -1717,7 +1716,7 @@ ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t typ
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if ((data = data_accept(data, ftp)) == NULL) {
|
||||
if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) {
|
||||
goto bail;
|
||||
}
|
||||
|
||||
@ -1834,7 +1833,7 @@ ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type
|
||||
if (!ftp_getresp(ftp) || (ftp->resp != 150 && ftp->resp != 125)) {
|
||||
goto bail;
|
||||
}
|
||||
if ((data = data_accept(data, ftp)) == NULL) {
|
||||
if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) {
|
||||
goto bail;
|
||||
}
|
||||
ftp->data = data;
|
||||
|
@ -131,7 +131,7 @@ static PHP_RINIT_FUNCTION(pcre)
|
||||
|
||||
/* {{{ pcre_get_compiled_regex
|
||||
*/
|
||||
PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *preg_options) {
|
||||
PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *preg_options TSRMLS_DC) {
|
||||
pcre *re = NULL;
|
||||
int coptions = 0;
|
||||
int soptions = 0;
|
||||
@ -151,7 +151,6 @@ PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *preg_
|
||||
#endif
|
||||
pcre_cache_entry *pce;
|
||||
pcre_cache_entry new_entry;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
/* Try to lookup the cached regex entry, and if successful, just pass
|
||||
back the compiled pattern, otherwise go on and compile it. */
|
||||
@ -408,7 +407,7 @@ static void php_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global)
|
||||
}
|
||||
|
||||
/* Compile regex or get it from cache. */
|
||||
if ((re = pcre_get_compiled_regex(Z_STRVAL_PP(regex), &extra, &preg_options)) == NULL) {
|
||||
if ((re = pcre_get_compiled_regex(Z_STRVAL_PP(regex), &extra, &preg_options TSRMLS_CC)) == NULL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@ -612,14 +611,13 @@ static int preg_get_backref(char **str, int *backref)
|
||||
|
||||
/* {{{ preg_do_repl_func
|
||||
*/
|
||||
static int preg_do_repl_func(zval *function, char *subject, int *offsets, int count, char **result)
|
||||
static int preg_do_repl_func(zval *function, char *subject, int *offsets, int count, char **result TSRMLS_DC)
|
||||
{
|
||||
zval *retval_ptr; /* Function return value */
|
||||
zval **args[1]; /* Argument to pass to function */
|
||||
zval *subpats; /* Captured subpatterns */
|
||||
int result_len; /* Return value length */
|
||||
int i;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
MAKE_STD_ZVAL(subpats);
|
||||
array_init(subpats);
|
||||
@ -769,7 +767,7 @@ PHPAPI char *php_pcre_replace(char *regex, int regex_len,
|
||||
walk_last; /* Last walked character */
|
||||
|
||||
/* Compile regex or get it from cache. */
|
||||
if ((re = pcre_get_compiled_regex(regex, &extra, &preg_options)) == NULL) {
|
||||
if ((re = pcre_get_compiled_regex(regex, &extra, &preg_options TSRMLS_CC)) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -824,7 +822,7 @@ PHPAPI char *php_pcre_replace(char *regex, int regex_len,
|
||||
} else if (is_callable_replace) {
|
||||
/* Use custom function to get replacement string and its length. */
|
||||
eval_result_len = preg_do_repl_func(replace_val, subject, offsets,
|
||||
count, &eval_result);
|
||||
count, &eval_result TSRMLS_CC);
|
||||
new_len += eval_result_len;
|
||||
} else { /* do regular substitution */
|
||||
walk = replace;
|
||||
@ -1174,7 +1172,7 @@ PHP_FUNCTION(preg_split)
|
||||
convert_to_string_ex(subject);
|
||||
|
||||
/* Compile regex or get it from cache. */
|
||||
if ((re = pcre_get_compiled_regex(Z_STRVAL_PP(regex), &extra, &preg_options)) == NULL) {
|
||||
if ((re = pcre_get_compiled_regex(Z_STRVAL_PP(regex), &extra, &preg_options TSRMLS_CC)) == NULL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@ -1408,7 +1406,7 @@ PHP_FUNCTION(preg_grep)
|
||||
}
|
||||
|
||||
/* Compile regex or get it from cache. */
|
||||
if ((re = pcre_get_compiled_regex(Z_STRVAL_PP(regex), &extra, &preg_options)) == NULL) {
|
||||
if ((re = pcre_get_compiled_regex(Z_STRVAL_PP(regex), &extra, &preg_options TSRMLS_CC)) == NULL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ PHP_FUNCTION(preg_quote);
|
||||
PHP_FUNCTION(preg_grep);
|
||||
|
||||
PHPAPI char *php_pcre_replace(char *regex, int regex_len, char *subject, int subject_len, zval *replace_val, int is_callable_replace, int *result_len, int limit TSRMLS_DC);
|
||||
PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *options);
|
||||
PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *options TSRMLS_DC);
|
||||
|
||||
extern zend_module_entry pcre_module_entry;
|
||||
#define pcre_module_ptr &pcre_module_entry
|
||||
|
@ -959,7 +959,7 @@ static void php_session_send_cookie(TSRMLS_D)
|
||||
struct timeval tv;
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
date_fmt = php_std_date(tv.tv_sec + PS(cookie_lifetime));
|
||||
date_fmt = php_std_date(tv.tv_sec + PS(cookie_lifetime) TSRMLS_CC);
|
||||
|
||||
smart_str_appends(&ncookie, COOKIE_EXPIRES);
|
||||
smart_str_appends(&ncookie, date_fmt);
|
||||
|
@ -100,7 +100,7 @@ static void aggregate_methods(zend_class_entry *ce, zend_class_entry *from_ce, i
|
||||
}
|
||||
#if (HAVE_PCRE || HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE)
|
||||
else if (aggr_type == AGGREGATE_BY_REGEXP) {
|
||||
if ((re = pcre_get_compiled_regex(Z_STRVAL_P(aggr_filter), &re_extra, &re_options)) == NULL) {
|
||||
if ((re = pcre_get_compiled_regex(Z_STRVAL_P(aggr_filter), &re_extra, &re_options TSRMLS_CC)) == NULL) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -206,7 +206,7 @@ static void aggregate_properties(zval *obj, zend_class_entry *from_ce, int aggr_
|
||||
}
|
||||
#if (HAVE_PCRE || HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE)
|
||||
else if (aggr_type == AGGREGATE_BY_REGEXP) {
|
||||
if ((re = pcre_get_compiled_regex(Z_STRVAL_P(aggr_filter), &re_extra, &re_options)) == NULL) {
|
||||
if ((re = pcre_get_compiled_regex(Z_STRVAL_P(aggr_filter), &re_extra, &re_options TSRMLS_CC)) == NULL) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -2919,8 +2919,6 @@ PHP_FUNCTION(parse_ini_file)
|
||||
convert_to_boolean_ex(process_sections);
|
||||
|
||||
if (Z_BVAL_PP(process_sections)) {
|
||||
TSRMLS_FETCH();
|
||||
|
||||
BG(active_ini_file_section) = NULL;
|
||||
ini_parser_cb = (zend_ini_parser_cb_t) php_ini_parser_cb_with_sections;
|
||||
} else {
|
||||
|
@ -26,10 +26,8 @@
|
||||
|
||||
/* {{{ php_print_credits
|
||||
*/
|
||||
PHPAPI void php_print_credits(int flag)
|
||||
PHPAPI void php_print_credits(int flag TSRMLS_DC)
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (flag & PHP_CREDITS_FULLPAGE) {
|
||||
php_print_info_htmlhead(TSRMLS_C);
|
||||
}
|
||||
|
@ -37,6 +37,6 @@
|
||||
|
||||
#endif /* HAVE_CREDITS_DEFS */
|
||||
|
||||
PHPAPI void php_print_credits(int flag);
|
||||
PHPAPI void php_print_credits(int flag TSRMLS_DC);
|
||||
|
||||
#endif
|
||||
|
@ -24,10 +24,8 @@
|
||||
|
||||
/* {{{ php_info_print_css
|
||||
*/
|
||||
PHPAPI void php_info_print_css(void)
|
||||
PHPAPI void php_info_print_css(TSRMLS_D)
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
PUTS("body {background-color: #ffffff; color: #000000;}\n");
|
||||
PUTS("body, td, th, h1, h2 {font-family: sans-serif;}\n");
|
||||
PUTS("pre {margin: 0px; font-family: monospace;}\n");
|
||||
|
@ -21,6 +21,6 @@
|
||||
#ifndef CSS_H
|
||||
#define CSS_H
|
||||
|
||||
PHPAPI void php_info_print_css(void);
|
||||
PHPAPI void php_info_print_css(TSRMLS_D);
|
||||
|
||||
#endif
|
||||
|
@ -881,11 +881,10 @@ PHP_FUNCTION(getdate)
|
||||
|
||||
/* {{{ php_std_date
|
||||
Return date string in standard format for http headers */
|
||||
char *php_std_date(time_t t)
|
||||
char *php_std_date(time_t t TSRMLS_DC)
|
||||
{
|
||||
struct tm *tm1, tmbuf;
|
||||
char *str;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
tm1 = php_gmtime_r(&t, &tmbuf);
|
||||
str = emalloc(81);
|
||||
|
@ -38,7 +38,7 @@ PHP_FUNCTION(gmstrftime);
|
||||
PHP_FUNCTION(strtotime);
|
||||
|
||||
int php_idate(char format, int timestamp, int gm);
|
||||
extern char *php_std_date(time_t t);
|
||||
extern char *php_std_date(time_t t TSRMLS_DC);
|
||||
void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm);
|
||||
#if HAVE_STRFTIME
|
||||
void _php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm);
|
||||
|
@ -55,10 +55,8 @@ PHP_FUNCTION(header)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
PHPAPI int php_header()
|
||||
PHPAPI int php_header(TSRMLS_D)
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (sapi_send_headers(TSRMLS_C)==FAILURE || SG(request_info).headers_only) {
|
||||
return 0; /* don't allow output */
|
||||
} else {
|
||||
@ -98,14 +96,14 @@ PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, t
|
||||
* pick an expiry date 1 year and 1 second in the past
|
||||
*/
|
||||
t = time(NULL) - 31536001;
|
||||
dt = php_std_date(t);
|
||||
dt = php_std_date(t TSRMLS_CC);
|
||||
sprintf(cookie, "Set-Cookie: %s=deleted; expires=%s", name, dt);
|
||||
efree(dt);
|
||||
} else {
|
||||
sprintf(cookie, "Set-Cookie: %s=%s", name, value ? encoded_value : "");
|
||||
if (expires > 0) {
|
||||
strcat(cookie, "; expires=");
|
||||
dt = php_std_date(expires);
|
||||
dt = php_std_date(expires TSRMLS_CC);
|
||||
strcat(cookie, dt);
|
||||
efree(dt);
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ PHP_FUNCTION(header);
|
||||
PHP_FUNCTION(setcookie);
|
||||
PHP_FUNCTION(headers_sent);
|
||||
|
||||
PHPAPI int php_header(void);
|
||||
PHPAPI int php_header(TSRMLS_D);
|
||||
PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, time_t expires, char *path, int path_len, char *domain, int domain_len, int secure TSRMLS_DC);
|
||||
|
||||
#endif
|
||||
|
@ -184,10 +184,10 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC)
|
||||
|
||||
/* {{{ php_info_print_style
|
||||
*/
|
||||
void php_info_print_style(void)
|
||||
void php_info_print_style(TSRMLS_D)
|
||||
{
|
||||
php_printf("<style type=\"text/css\"><!--\n");
|
||||
php_info_print_css();
|
||||
php_info_print_css(TSRMLS_C);
|
||||
php_printf("//--></style>\n");
|
||||
}
|
||||
/* }}} */
|
||||
@ -357,7 +357,7 @@ PHPAPI void php_print_info_htmlhead(TSRMLS_D)
|
||||
PUTS("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"DTD/xhtml1-transitional.dtd\">\n");
|
||||
PUTS("<html>");
|
||||
PUTS("<head>\n");
|
||||
php_info_print_style();
|
||||
php_info_print_style(TSRMLS_C);
|
||||
PUTS("<title>phpinfo()</title>");
|
||||
/*
|
||||
php_printf("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\" />\n", charset);
|
||||
@ -897,7 +897,7 @@ PHP_FUNCTION(phpcredits)
|
||||
flag = PHP_CREDITS_ALL;
|
||||
}
|
||||
|
||||
php_print_credits(flag);
|
||||
php_print_credits(flag TSRMLS_CC);
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -68,7 +68,7 @@ PHPAPI char *php_info_html_esc(char *string TSRMLS_DC);
|
||||
PHPAPI void php_print_info_htmlhead(TSRMLS_D);
|
||||
PHPAPI void php_print_info(int flag TSRMLS_DC);
|
||||
PHPAPI void php_print_style(void);
|
||||
PHPAPI void php_info_print_style(void);
|
||||
PHPAPI void php_info_print_style(TSRMLS_D);
|
||||
PHPAPI void php_info_print_table_colspan_header(int num_cols, char *header);
|
||||
PHPAPI void php_info_print_table_header(int num_cols, ...);
|
||||
PHPAPI void php_info_print_table_row(int num_cols, ...);
|
||||
|
@ -75,10 +75,8 @@ static int reference_levdist(const char *s1, int l1,
|
||||
|
||||
/* {{{ custom_levdist
|
||||
*/
|
||||
static int custom_levdist(char *str1, char *str2, char *callback_name)
|
||||
static int custom_levdist(char *str1, char *str2, char *callback_name TSRMLS_DC)
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The general Levenshtein support is not there yet");
|
||||
/* not there yet */
|
||||
|
||||
@ -132,7 +130,7 @@ PHP_FUNCTION(levenshtein)
|
||||
convert_to_string_ex(callback_name);
|
||||
|
||||
distance = custom_levdist(Z_STRVAL_PP(str1), Z_STRVAL_PP(str2),
|
||||
Z_STRVAL_PP(callback_name));
|
||||
Z_STRVAL_PP(callback_name) TSRMLS_CC);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -683,10 +683,10 @@ static int php_ub_body_write(const char *str, uint str_length TSRMLS_DC)
|
||||
int result = 0;
|
||||
|
||||
if (SG(request_info).headers_only) {
|
||||
php_header();
|
||||
php_header(TSRMLS_C);
|
||||
zend_bailout();
|
||||
}
|
||||
if (php_header()) {
|
||||
if (php_header(TSRMLS_C)) {
|
||||
if (zend_is_compiling(TSRMLS_C)) {
|
||||
OG(output_start_filename) = zend_get_compiled_filename(TSRMLS_C);
|
||||
OG(output_start_lineno) = zend_get_compiled_lineno(TSRMLS_C);
|
||||
|
@ -454,7 +454,7 @@ PHPAPI int php_handle_special_queries(TSRMLS_D)
|
||||
if (php_info_logos(SG(request_info).query_string+1 TSRMLS_CC)) {
|
||||
return 1;
|
||||
} else if (!strcmp(SG(request_info).query_string+1, PHP_CREDITS_GUID)) {
|
||||
php_print_credits(PHP_CREDITS_ALL);
|
||||
php_print_credits(PHP_CREDITS_ALL TSRMLS_CC);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ PHP_FUNCTION(virtual)
|
||||
}
|
||||
|
||||
php_end_ob_buffers(1 TSRMLS_CC);
|
||||
php_header();
|
||||
php_header(TSRMLS_C);
|
||||
|
||||
if (run_sub_req(rr)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - request execution failed", (*filename)->value.str.val);
|
||||
|
@ -92,7 +92,7 @@ PHP_FUNCTION(virtual)
|
||||
|
||||
/* Flush everything. */
|
||||
php_end_ob_buffers(1 TSRMLS_CC);
|
||||
php_header();
|
||||
php_header(TSRMLS_C);
|
||||
|
||||
if (ap_run_sub_req(rr)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - request execution failed", Z_STRVAL_PP(filename));
|
||||
|
@ -1732,7 +1732,7 @@ PHP_FUNCTION(virtual)
|
||||
}
|
||||
|
||||
php_end_ob_buffers(1 TSRMLS_CC);
|
||||
php_header();
|
||||
php_header(TSRMLS_C);
|
||||
|
||||
if (run_sub_req(rr)) {
|
||||
php_error(E_WARNING, "Unable to include '%s' - request execution failed", (*filename)->value.str.val);
|
||||
|
@ -464,7 +464,9 @@ static void sapi_cgi_register_variables(zval *track_vars_array TSRMLS_DC)
|
||||
|
||||
static void sapi_cgi_log_message(char *message)
|
||||
{
|
||||
if (php_header()) {
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (php_header(TSRMLS_C)) {
|
||||
fprintf(stderr, "%s", message);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
@ -238,7 +238,9 @@ static void sapi_cli_register_variables(zval *track_vars_array TSRMLS_DC)
|
||||
|
||||
static void sapi_cli_log_message(char *message)
|
||||
{
|
||||
if (php_header()) {
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (php_header(TSRMLS_C)) {
|
||||
fprintf(stderr, "%s", message);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ JNIEXPORT void JNICALL Java_net_php_servlet_send
|
||||
}
|
||||
} else {
|
||||
php_execute_script(&file_handle TSRMLS_CC);
|
||||
php_header(); /* Make sure headers have been sent */
|
||||
php_header(TSRMLS_C); /* Make sure headers have been sent */
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user