Remove a couple TSRMLS_FETCH() calls around ext/main/sapi

This commit is contained in:
Kalle Sommer Nielsen 2010-04-13 11:02:15 +00:00
parent 1b8b6d931a
commit 7ef4cdf471
13 changed files with 47 additions and 76 deletions

View File

@ -45,22 +45,16 @@ typedef struct {
} php_istream;
static int le_istream;
static void istream_destructor(php_istream *stm);
static void istream_destructor(php_istream *stm TSRMLS_DC);
static void istream_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
{
php_istream *stm = (php_istream *)rsrc->ptr;
istream_destructor(stm);
istream_destructor(stm TSRMLS_CC);
}
#ifdef ZTS
# define TSRMLS_FIXED() TSRMLS_FETCH();
#else
# define TSRMLS_FIXED()
#endif
#define FETCH_STM() \
TSRMLS_FIXED() \
TSRMLS_FETCH(); \
php_istream *stm = (php_istream*)This; \
if (GetCurrentThreadId() != stm->engine_thread) \
return RPC_E_WRONG_THREAD;
@ -250,10 +244,8 @@ static struct IStreamVtbl php_istream_vtbl = {
stm_clone
};
static void istream_destructor(php_istream *stm)
static void istream_destructor(php_istream *stm TSRMLS_DC)
{
TSRMLS_FETCH();
if (stm->id) {
int id = stm->id;
stm->id = 0;

View File

@ -52,12 +52,12 @@ typedef struct {
static int le_dispatch;
static void disp_destructor(php_dispatchex *disp);
static void disp_destructor(php_dispatchex *disp TSRMLS_DC);
static void dispatch_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
{
php_dispatchex *disp = (php_dispatchex *)rsrc->ptr;
disp_destructor(disp);
disp_destructor(disp TSRMLS_CC);
}
int php_com_wrapper_minit(INIT_FUNC_ARGS)
@ -86,14 +86,8 @@ static inline void trace(char *fmt, ...)
}
/* }}} */
#ifdef ZTS
# define TSRMLS_FIXED() TSRMLS_FETCH();
#else
# define TSRMLS_FIXED()
#endif
#define FETCH_DISP(methname) \
TSRMLS_FIXED() \
TSRMLS_FETCH(); \
php_dispatchex *disp = (php_dispatchex*)This; \
if (COMG(rshutdown_started)) { \
trace(" PHP Object:%p (name:unknown) %s\n", disp->object, methname); \
@ -559,10 +553,8 @@ static php_dispatchex *disp_constructor(zval *object TSRMLS_DC)
return disp;
}
static void disp_destructor(php_dispatchex *disp)
{
TSRMLS_FETCH();
static void disp_destructor(php_dispatchex *disp TSRMLS_DC)
{
/* Object store not available during request shutdown */
if (COMG(rshutdown_started)) {
trace("destroying COM wrapper for PHP object %p (name:unknown)\n", disp->object);

View File

@ -163,14 +163,12 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
# define php_curl_ret(__ret) RETVAL_FALSE; return;
#endif
static int php_curl_option_url(php_curl *ch, const char *url, const int len) /* {{{ */
static int php_curl_option_url(php_curl *ch, const char *url, const int len TSRMLS_DC) /* {{{ */
{
CURLcode error = CURLE_OK;
#if LIBCURL_VERSION_NUM < 0x071100
char *copystr = NULL;
#endif
TSRMLS_FETCH();
/* Disable file:// if open_basedir or safe_mode are used */
if ((PG(open_basedir) && *PG(open_basedir)) || PG(safe_mode)) {
#if LIBCURL_VERSION_NUM >= 0x071304
@ -1474,7 +1472,7 @@ PHP_FUNCTION(curl_init)
#endif
if (url) {
if (!php_curl_option_url(ch, url, url_len)) {
if (!php_curl_option_url(ch, url, url_len TSRMLS_CC)) {
_php_curl_close_ex(ch TSRMLS_CC);
RETURN_FALSE;
}
@ -1737,7 +1735,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
}
#endif
if (option == CURLOPT_URL) {
if (!php_curl_option_url(ch, Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue))) {
if (!php_curl_option_url(ch, Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue) TSRMLS_CC)) {
RETVAL_FALSE;
return 1;
}

View File

@ -124,12 +124,11 @@ static int ereg_clean_cache(void *data, void *arg TSRMLS_DC)
/* {{{ _php_regcomp
*/
static int _php_regcomp(regex_t *preg, const char *pattern, int cflags)
static int _php_regcomp(regex_t *preg, const char *pattern, int cflags TSRMLS_DC)
{
int r = 0;
int patlen = strlen(pattern);
reg_cache *rc = NULL;
TSRMLS_FETCH();
if (zend_hash_num_elements(&EREG(ht_rc)) >= EREG_CACHE_SIZE) {
/* easier than dealing with overflow as it happens */
@ -201,7 +200,7 @@ static void _free_ereg_cache(reg_cache *rc)
#undef regfree
#define regfree(a);
#undef regcomp
#define regcomp(a, b, c) _php_regcomp(a, b, c)
#define regcomp(a, b, c) _php_regcomp(a, b, c TSRMLS_CC)
static void php_ereg_init_globals(zend_ereg_globals *ereg_globals TSRMLS_DC)
{
@ -400,7 +399,7 @@ PHP_FUNCTION(eregi)
/* {{{ php_ereg_replace
* this is the meat and potatoes of regex replacement! */
PHPAPI char *php_ereg_replace(const char *pattern, const char *replace, const char *string, int icase, int extended)
PHPAPI char *php_ereg_replace(const char *pattern, const char *replace, const char *string, int icase, int extended TSRMLS_DC)
{
regex_t re;
regmatch_t *subs;
@ -593,7 +592,7 @@ static void php_do_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase)
}
/* do the actual work */
ret = php_ereg_replace(pattern, replace, string, icase, 1);
ret = php_ereg_replace(pattern, replace, string, icase, 1 TSRMLS_CC);
if (ret == (char *) -1) {
RETVAL_FALSE;
} else {

View File

@ -27,7 +27,7 @@
extern zend_module_entry ereg_module_entry;
#define phpext_ereg_ptr &ereg_module_entry
PHPAPI char *php_ereg_replace(const char *pattern, const char *replace, const char *string, int icase, int extended);
PHPAPI char *php_ereg_replace(const char *pattern, const char *replace, const char *string, int icase, int extended TSRMLS_DC);
PHP_FUNCTION(ereg);
PHP_FUNCTION(eregi);

View File

@ -336,9 +336,9 @@ php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, l
sb4 php_oci_define_callback(dvoid *ctx, OCIDefine *define, ub4 iter, dvoid **bufpp, ub4 **alenpp, ub1 *piecep, dvoid **indpp, ub2 **rcpp)
{
php_oci_out_column *outcol = (php_oci_out_column *)ctx;
TSRMLS_FETCH();
if (!outcol) {
TSRMLS_FETCH();
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid context pointer value");
return OCI_ERROR;
@ -347,7 +347,6 @@ sb4 php_oci_define_callback(dvoid *ctx, OCIDefine *define, ub4 iter, dvoid **buf
switch(outcol->data_type) {
case SQLT_RSET: {
php_oci_statement *nested_stmt;
TSRMLS_FETCH();
nested_stmt = php_oci_statement_create(outcol->statement->connection, NULL, 0 TSRMLS_CC);
if (!nested_stmt) {
@ -372,7 +371,6 @@ sb4 php_oci_define_callback(dvoid *ctx, OCIDefine *define, ub4 iter, dvoid **buf
case SQLT_BFILE: {
php_oci_descriptor *descr;
int dtype;
TSRMLS_FETCH();
if (outcol->data_type == SQLT_BFILE) {
dtype = OCI_DTYPE_FILE;

View File

@ -852,12 +852,10 @@ static void php_openssl_dispose_config(struct php_x509_request * req TSRMLS_DC)
}
/* }}} */
static int php_openssl_load_rand_file(const char * file, int *egdsocket, int *seeded) /* {{{ */
static int php_openssl_load_rand_file(const char * file, int *egdsocket, int *seeded TSRMLS_DC) /* {{{ */
{
char buffer[MAXPATHLEN];
TSRMLS_FETCH();
*egdsocket = 0;
*seeded = 0;
@ -2742,7 +2740,7 @@ static EVP_PKEY * php_openssl_generate_private_key(struct php_x509_request * req
}
randfile = CONF_get_string(req->req_config, req->section_name, "RANDFILE");
php_openssl_load_rand_file(randfile, &egdsocket, &seeded);
php_openssl_load_rand_file(randfile, &egdsocket, &seeded TSRMLS_CC);
if ((req->priv_key = EVP_PKEY_new()) != NULL) {
switch(req->priv_key_type) {

View File

@ -1188,11 +1188,10 @@ static int php_sybase_finish_results(sybase_result *result TSRMLS_DC)
ZVAL_STRINGL(&result, buf, length- 1, 1); \
}
static int php_sybase_fetch_result_row (sybase_result *result, int numrows)
static int php_sybase_fetch_result_row(sybase_result *result, int numrows TSRMLS_DC)
{
int i, j;
CS_INT retcode;
TSRMLS_FETCH();
/* We've already fetched everything */
if (result->last_retcode == CS_END_DATA || result->last_retcode == CS_END_RESULTS) {
@ -1282,7 +1281,7 @@ static int php_sybase_fetch_result_row (sybase_result *result, int numrows)
return retcode;
}
static sybase_result * php_sybase_fetch_result_set (sybase_link *sybase_ptr, int buffered, int store)
static sybase_result * php_sybase_fetch_result_set(sybase_link *sybase_ptr, int buffered, int store TSRMLS_DC)
{
int num_fields;
sybase_result *result;
@ -1401,7 +1400,7 @@ static sybase_result * php_sybase_fetch_result_set (sybase_link *sybase_ptr, int
if (buffered) {
retcode = CS_SUCCEED;
} else {
if ((retcode = php_sybase_fetch_result_row(result, -1)) == CS_FAIL) {
if ((retcode = php_sybase_fetch_result_row(result, -1 TSRMLS_CC)) == CS_FAIL) {
return NULL;
}
}
@ -1538,7 +1537,7 @@ static void php_sybase_query (INTERNAL_FUNCTION_PARAMETERS, int buffered)
case CS_PARAM_RESULT:
case CS_ROW_RESULT:
case CS_STATUS_RESULT:
result = php_sybase_fetch_result_set(sybase_ptr, buffered, store);
result = php_sybase_fetch_result_set(sybase_ptr, buffered, store TSRMLS_CC);
if (result == NULL) {
ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_ALL);
RETURN_FALSE;
@ -1564,7 +1563,7 @@ static void php_sybase_query (INTERNAL_FUNCTION_PARAMETERS, int buffered)
case CS_PARAM_RESULT:
case CS_ROW_RESULT:
if (status != Q_RESULT) {
result = php_sybase_fetch_result_set(sybase_ptr, buffered, store);
result = php_sybase_fetch_result_set(sybase_ptr, buffered, store TSRMLS_CC);
if (result == NULL) {
ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_ALL);
sybase_ptr->dead = 1;
@ -1756,7 +1755,7 @@ PHP_FUNCTION(sybase_fetch_row)
/* Unbuffered? */
if (result->last_retcode != CS_END_DATA && result->last_retcode != CS_END_RESULTS) {
php_sybase_fetch_result_row(result, 1);
php_sybase_fetch_result_row(result, 1 TSRMLS_CC);
}
/* At the end? */
@ -1792,7 +1791,7 @@ static void php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int numerics)
/* Unbuffered ? Fetch next row */
if (result->last_retcode != CS_END_DATA && result->last_retcode != CS_END_RESULTS) {
php_sybase_fetch_result_row(result, 1);
php_sybase_fetch_result_row(result, 1 TSRMLS_CC);
}
/* At the end? */
@ -1910,7 +1909,7 @@ PHP_FUNCTION(sybase_data_seek)
/* Unbuffered ? */
if (result->last_retcode != CS_END_DATA && result->last_retcode != CS_END_RESULTS && offset >= result->num_rows) {
php_sybase_fetch_result_row(result, offset+ 1);
php_sybase_fetch_result_row(result, offset+ 1 TSRMLS_CC);
}
if (offset < 0 || offset >= result->num_rows) {
@ -2044,7 +2043,7 @@ PHP_FUNCTION(sybase_result)
/* Unbuffered ? */
if (result->last_retcode != CS_END_DATA && result->last_retcode != CS_END_RESULTS && row >= result->num_rows) {
php_sybase_fetch_result_row(result, row);
php_sybase_fetch_result_row(result, row TSRMLS_CC);
}
if (row < 0 || row >= result->num_rows) {

View File

@ -113,9 +113,9 @@ PHPAPI int core_globals_id;
#ifdef PHP_WIN32
#include "win32_internal_function_disabled.h"
static php_win32_disable_functions() {
static php_win32_disable_functions(TSRMLS_D)
{
int i;
TSRMLS_FETCH();
if (EG(windows_version_info).dwMajorVersion < 5) {
for (i = 0; i < function_name_cnt_5; i++) {
@ -2044,7 +2044,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
#ifdef PHP_WIN32
/* Disable incompatible functions for the running platform */
if (php_win32_disable_functions() == FAILURE) {
if (php_win32_disable_functions(TSRMLS_C) == FAILURE) {
php_printf("Unable to disable unsupported functions\n");
return FAILURE;
}

View File

@ -533,14 +533,14 @@ PHP_FUNCTION(apache_lookup_uri)
#if 0
/*
This function is most likely a bad idea. Just playing with it for now.
*/
PHP_FUNCTION(apache_exec_uri)
{
char *filename;
int filename_len;
request_rec *rr=NULL;
TSRMLS_FETCH();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
return;

View File

@ -1,20 +1,20 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2010 The PHP Group |
| Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available at through the world-wide-web at |
| http://www.php.net/license/3_01.txt |
| that is bundled with this package in the file LICENSE, and is |
| available at through the world-wide-web at |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Rasmus Lerdorf <rasmus@php.net> |
| (with helpful hints from Dean Gaudet <dgaudet@arctic.org> |
| PHP 4.0 patches by Zeev Suraski <zeev@zend.com> |
| Authors: Rasmus Lerdorf <rasmus@php.net> |
| (with helpful hints from Dean Gaudet <dgaudet@arctic.org> |
| PHP 4.0 patches by Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */

View File

@ -1906,13 +1906,14 @@ PHP_FUNCTION(apache_lookup_uri)
#if 0
/*
This function is most likely a bad idea. Just playing with it for now.
*/
PHP_FUNCTION(apache_exec_uri)
{
zval **filename;
request_rec *rr=NULL;
TSRMLS_FETCH();
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) {
WRONG_PARAM_COUNT;

View File

@ -71,7 +71,6 @@ php_phttpd_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_str
{
char *header_name, *header_content;
char *p;
TSRMLS_FETCH();
http_sendheaders(PHG(cip)->fd, PHG(cip), SG(sapi_headers).http_response_code, NULL);
@ -97,8 +96,6 @@ php_phttpd_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_str
static int
php_phttpd_sapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
{
TSRMLS_FETCH();
if (SG(sapi_headers).send_default_content_type) {
fd_printf(PHG(cip)->fd,"Content-Type: text/html\n");
}
@ -115,7 +112,6 @@ php_phttpd_sapi_read_cookies(TSRMLS_D)
/*
int i;
char *http_cookie = NULL;
NTSRMLS_FETCH();
i = Ns_SetIFind(NSG(conn->headers), "cookie");
if(i != -1) {
@ -135,7 +131,6 @@ php_phttpd_sapi_read_post(char *buf, uint count_bytes TSRMLS_DC)
/*
uint max_read;
uint total_read = 0;
NTSRMLS_FETCH();
max_read = MIN(NSG(data_avail), count_bytes);
@ -243,12 +238,11 @@ php_phttpd_request_dtor(TSRMLS_D TSRMLS_DC)
}
int php_doit(TSRMLS_D TSRMLS_DC)
int php_doit(TSRMLS_D)
{
struct stat sb;
zend_file_handle file_handle;
struct httpinfo *hip = PHG(cip)->hip;
TSRMLS_FETCH();
if (php_request_startup(TSRMLS_C) == FAILURE) {
return -1;