Skip to content

Commit 7ef4cdf

Browse files
committed
Remove a couple TSRMLS_FETCH() calls around ext/main/sapi
1 parent 1b8b6d9 commit 7ef4cdf

File tree

13 files changed

+47
-76
lines changed

13 files changed

+47
-76
lines changed

ext/com_dotnet/com_persist.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,16 @@ typedef struct {
4545
} php_istream;
4646

4747
static int le_istream;
48-
static void istream_destructor(php_istream *stm);
48+
static void istream_destructor(php_istream *stm TSRMLS_DC);
4949

5050
static void istream_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
5151
{
5252
php_istream *stm = (php_istream *)rsrc->ptr;
53-
istream_destructor(stm);
53+
istream_destructor(stm TSRMLS_CC);
5454
}
5555

56-
#ifdef ZTS
57-
# define TSRMLS_FIXED() TSRMLS_FETCH();
58-
#else
59-
# define TSRMLS_FIXED()
60-
#endif
61-
6256
#define FETCH_STM() \
63-
TSRMLS_FIXED() \
57+
TSRMLS_FETCH(); \
6458
php_istream *stm = (php_istream*)This; \
6559
if (GetCurrentThreadId() != stm->engine_thread) \
6660
return RPC_E_WRONG_THREAD;
@@ -250,10 +244,8 @@ static struct IStreamVtbl php_istream_vtbl = {
250244
stm_clone
251245
};
252246

253-
static void istream_destructor(php_istream *stm)
247+
static void istream_destructor(php_istream *stm TSRMLS_DC)
254248
{
255-
TSRMLS_FETCH();
256-
257249
if (stm->id) {
258250
int id = stm->id;
259251
stm->id = 0;

ext/com_dotnet/com_wrapper.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ typedef struct {
5252

5353
static int le_dispatch;
5454

55-
static void disp_destructor(php_dispatchex *disp);
55+
static void disp_destructor(php_dispatchex *disp TSRMLS_DC);
5656

5757
static void dispatch_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
5858
{
5959
php_dispatchex *disp = (php_dispatchex *)rsrc->ptr;
60-
disp_destructor(disp);
60+
disp_destructor(disp TSRMLS_CC);
6161
}
6262

6363
int php_com_wrapper_minit(INIT_FUNC_ARGS)
@@ -86,14 +86,8 @@ static inline void trace(char *fmt, ...)
8686
}
8787
/* }}} */
8888

89-
#ifdef ZTS
90-
# define TSRMLS_FIXED() TSRMLS_FETCH();
91-
#else
92-
# define TSRMLS_FIXED()
93-
#endif
94-
9589
#define FETCH_DISP(methname) \
96-
TSRMLS_FIXED() \
90+
TSRMLS_FETCH(); \
9791
php_dispatchex *disp = (php_dispatchex*)This; \
9892
if (COMG(rshutdown_started)) { \
9993
trace(" PHP Object:%p (name:unknown) %s\n", disp->object, methname); \
@@ -559,10 +553,8 @@ static php_dispatchex *disp_constructor(zval *object TSRMLS_DC)
559553
return disp;
560554
}
561555

562-
static void disp_destructor(php_dispatchex *disp)
563-
{
564-
TSRMLS_FETCH();
565-
556+
static void disp_destructor(php_dispatchex *disp TSRMLS_DC)
557+
{
566558
/* Object store not available during request shutdown */
567559
if (COMG(rshutdown_started)) {
568560
trace("destroying COM wrapper for PHP object %p (name:unknown)\n", disp->object);

ext/curl/interface.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,12 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
163163
# define php_curl_ret(__ret) RETVAL_FALSE; return;
164164
#endif
165165

166-
static int php_curl_option_url(php_curl *ch, const char *url, const int len) /* {{{ */
166+
static int php_curl_option_url(php_curl *ch, const char *url, const int len TSRMLS_DC) /* {{{ */
167167
{
168168
CURLcode error = CURLE_OK;
169169
#if LIBCURL_VERSION_NUM < 0x071100
170170
char *copystr = NULL;
171171
#endif
172-
TSRMLS_FETCH();
173-
174172
/* Disable file:// if open_basedir or safe_mode are used */
175173
if ((PG(open_basedir) && *PG(open_basedir)) || PG(safe_mode)) {
176174
#if LIBCURL_VERSION_NUM >= 0x071304
@@ -1474,7 +1472,7 @@ PHP_FUNCTION(curl_init)
14741472
#endif
14751473

14761474
if (url) {
1477-
if (!php_curl_option_url(ch, url, url_len)) {
1475+
if (!php_curl_option_url(ch, url, url_len TSRMLS_CC)) {
14781476
_php_curl_close_ex(ch TSRMLS_CC);
14791477
RETURN_FALSE;
14801478
}
@@ -1737,7 +1735,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
17371735
}
17381736
#endif
17391737
if (option == CURLOPT_URL) {
1740-
if (!php_curl_option_url(ch, Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue))) {
1738+
if (!php_curl_option_url(ch, Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue) TSRMLS_CC)) {
17411739
RETVAL_FALSE;
17421740
return 1;
17431741
}

ext/ereg/ereg.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,11 @@ static int ereg_clean_cache(void *data, void *arg TSRMLS_DC)
124124

125125
/* {{{ _php_regcomp
126126
*/
127-
static int _php_regcomp(regex_t *preg, const char *pattern, int cflags)
127+
static int _php_regcomp(regex_t *preg, const char *pattern, int cflags TSRMLS_DC)
128128
{
129129
int r = 0;
130130
int patlen = strlen(pattern);
131131
reg_cache *rc = NULL;
132-
TSRMLS_FETCH();
133132

134133
if (zend_hash_num_elements(&EREG(ht_rc)) >= EREG_CACHE_SIZE) {
135134
/* easier than dealing with overflow as it happens */
@@ -201,7 +200,7 @@ static void _free_ereg_cache(reg_cache *rc)
201200
#undef regfree
202201
#define regfree(a);
203202
#undef regcomp
204-
#define regcomp(a, b, c) _php_regcomp(a, b, c)
203+
#define regcomp(a, b, c) _php_regcomp(a, b, c TSRMLS_CC)
205204

206205
static void php_ereg_init_globals(zend_ereg_globals *ereg_globals TSRMLS_DC)
207206
{
@@ -400,7 +399,7 @@ PHP_FUNCTION(eregi)
400399

401400
/* {{{ php_ereg_replace
402401
* this is the meat and potatoes of regex replacement! */
403-
PHPAPI char *php_ereg_replace(const char *pattern, const char *replace, const char *string, int icase, int extended)
402+
PHPAPI char *php_ereg_replace(const char *pattern, const char *replace, const char *string, int icase, int extended TSRMLS_DC)
404403
{
405404
regex_t re;
406405
regmatch_t *subs;
@@ -593,7 +592,7 @@ static void php_do_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase)
593592
}
594593

595594
/* do the actual work */
596-
ret = php_ereg_replace(pattern, replace, string, icase, 1);
595+
ret = php_ereg_replace(pattern, replace, string, icase, 1 TSRMLS_CC);
597596
if (ret == (char *) -1) {
598597
RETVAL_FALSE;
599598
} else {

ext/ereg/php_ereg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
extern zend_module_entry ereg_module_entry;
2828
#define phpext_ereg_ptr &ereg_module_entry
2929

30-
PHPAPI char *php_ereg_replace(const char *pattern, const char *replace, const char *string, int icase, int extended);
30+
PHPAPI char *php_ereg_replace(const char *pattern, const char *replace, const char *string, int icase, int extended TSRMLS_DC);
3131

3232
PHP_FUNCTION(ereg);
3333
PHP_FUNCTION(eregi);

ext/oci8/oci8_statement.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,9 @@ php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, l
336336
sb4 php_oci_define_callback(dvoid *ctx, OCIDefine *define, ub4 iter, dvoid **bufpp, ub4 **alenpp, ub1 *piecep, dvoid **indpp, ub2 **rcpp)
337337
{
338338
php_oci_out_column *outcol = (php_oci_out_column *)ctx;
339+
TSRMLS_FETCH();
339340

340341
if (!outcol) {
341-
TSRMLS_FETCH();
342342

343343
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid context pointer value");
344344
return OCI_ERROR;
@@ -347,7 +347,6 @@ sb4 php_oci_define_callback(dvoid *ctx, OCIDefine *define, ub4 iter, dvoid **buf
347347
switch(outcol->data_type) {
348348
case SQLT_RSET: {
349349
php_oci_statement *nested_stmt;
350-
TSRMLS_FETCH();
351350

352351
nested_stmt = php_oci_statement_create(outcol->statement->connection, NULL, 0 TSRMLS_CC);
353352
if (!nested_stmt) {
@@ -372,7 +371,6 @@ sb4 php_oci_define_callback(dvoid *ctx, OCIDefine *define, ub4 iter, dvoid **buf
372371
case SQLT_BFILE: {
373372
php_oci_descriptor *descr;
374373
int dtype;
375-
TSRMLS_FETCH();
376374

377375
if (outcol->data_type == SQLT_BFILE) {
378376
dtype = OCI_DTYPE_FILE;

ext/openssl/openssl.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -852,12 +852,10 @@ static void php_openssl_dispose_config(struct php_x509_request * req TSRMLS_DC)
852852
}
853853
/* }}} */
854854

855-
static int php_openssl_load_rand_file(const char * file, int *egdsocket, int *seeded) /* {{{ */
855+
static int php_openssl_load_rand_file(const char * file, int *egdsocket, int *seeded TSRMLS_DC) /* {{{ */
856856
{
857857
char buffer[MAXPATHLEN];
858858

859-
TSRMLS_FETCH();
860-
861859
*egdsocket = 0;
862860
*seeded = 0;
863861

@@ -2742,7 +2740,7 @@ static EVP_PKEY * php_openssl_generate_private_key(struct php_x509_request * req
27422740
}
27432741

27442742
randfile = CONF_get_string(req->req_config, req->section_name, "RANDFILE");
2745-
php_openssl_load_rand_file(randfile, &egdsocket, &seeded);
2743+
php_openssl_load_rand_file(randfile, &egdsocket, &seeded TSRMLS_CC);
27462744

27472745
if ((req->priv_key = EVP_PKEY_new()) != NULL) {
27482746
switch(req->priv_key_type) {

ext/sybase_ct/php_sybase_ct.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,11 +1188,10 @@ static int php_sybase_finish_results(sybase_result *result TSRMLS_DC)
11881188
ZVAL_STRINGL(&result, buf, length- 1, 1); \
11891189
}
11901190

1191-
static int php_sybase_fetch_result_row (sybase_result *result, int numrows)
1191+
static int php_sybase_fetch_result_row(sybase_result *result, int numrows TSRMLS_DC)
11921192
{
11931193
int i, j;
11941194
CS_INT retcode;
1195-
TSRMLS_FETCH();
11961195

11971196
/* We've already fetched everything */
11981197
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)
12821281
return retcode;
12831282
}
12841283

1285-
static sybase_result * php_sybase_fetch_result_set (sybase_link *sybase_ptr, int buffered, int store)
1284+
static sybase_result * php_sybase_fetch_result_set(sybase_link *sybase_ptr, int buffered, int store TSRMLS_DC)
12861285
{
12871286
int num_fields;
12881287
sybase_result *result;
@@ -1401,7 +1400,7 @@ static sybase_result * php_sybase_fetch_result_set (sybase_link *sybase_ptr, int
14011400
if (buffered) {
14021401
retcode = CS_SUCCEED;
14031402
} else {
1404-
if ((retcode = php_sybase_fetch_result_row(result, -1)) == CS_FAIL) {
1403+
if ((retcode = php_sybase_fetch_result_row(result, -1 TSRMLS_CC)) == CS_FAIL) {
14051404
return NULL;
14061405
}
14071406
}
@@ -1538,7 +1537,7 @@ static void php_sybase_query (INTERNAL_FUNCTION_PARAMETERS, int buffered)
15381537
case CS_PARAM_RESULT:
15391538
case CS_ROW_RESULT:
15401539
case CS_STATUS_RESULT:
1541-
result = php_sybase_fetch_result_set(sybase_ptr, buffered, store);
1540+
result = php_sybase_fetch_result_set(sybase_ptr, buffered, store TSRMLS_CC);
15421541
if (result == NULL) {
15431542
ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_ALL);
15441543
RETURN_FALSE;
@@ -1564,7 +1563,7 @@ static void php_sybase_query (INTERNAL_FUNCTION_PARAMETERS, int buffered)
15641563
case CS_PARAM_RESULT:
15651564
case CS_ROW_RESULT:
15661565
if (status != Q_RESULT) {
1567-
result = php_sybase_fetch_result_set(sybase_ptr, buffered, store);
1566+
result = php_sybase_fetch_result_set(sybase_ptr, buffered, store TSRMLS_CC);
15681567
if (result == NULL) {
15691568
ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_ALL);
15701569
sybase_ptr->dead = 1;
@@ -1756,7 +1755,7 @@ PHP_FUNCTION(sybase_fetch_row)
17561755

17571756
/* Unbuffered? */
17581757
if (result->last_retcode != CS_END_DATA && result->last_retcode != CS_END_RESULTS) {
1759-
php_sybase_fetch_result_row(result, 1);
1758+
php_sybase_fetch_result_row(result, 1 TSRMLS_CC);
17601759
}
17611760

17621761
/* At the end? */
@@ -1792,7 +1791,7 @@ static void php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int numerics)
17921791

17931792
/* Unbuffered ? Fetch next row */
17941793
if (result->last_retcode != CS_END_DATA && result->last_retcode != CS_END_RESULTS) {
1795-
php_sybase_fetch_result_row(result, 1);
1794+
php_sybase_fetch_result_row(result, 1 TSRMLS_CC);
17961795
}
17971796

17981797
/* At the end? */
@@ -1910,7 +1909,7 @@ PHP_FUNCTION(sybase_data_seek)
19101909

19111910
/* Unbuffered ? */
19121911
if (result->last_retcode != CS_END_DATA && result->last_retcode != CS_END_RESULTS && offset >= result->num_rows) {
1913-
php_sybase_fetch_result_row(result, offset+ 1);
1912+
php_sybase_fetch_result_row(result, offset+ 1 TSRMLS_CC);
19141913
}
19151914

19161915
if (offset < 0 || offset >= result->num_rows) {
@@ -2044,7 +2043,7 @@ PHP_FUNCTION(sybase_result)
20442043

20452044
/* Unbuffered ? */
20462045
if (result->last_retcode != CS_END_DATA && result->last_retcode != CS_END_RESULTS && row >= result->num_rows) {
2047-
php_sybase_fetch_result_row(result, row);
2046+
php_sybase_fetch_result_row(result, row TSRMLS_CC);
20482047
}
20492048

20502049
if (row < 0 || row >= result->num_rows) {

main/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ PHPAPI int core_globals_id;
113113
#ifdef PHP_WIN32
114114
#include "win32_internal_function_disabled.h"
115115

116-
static php_win32_disable_functions() {
116+
static php_win32_disable_functions(TSRMLS_D)
117+
{
117118
int i;
118-
TSRMLS_FETCH();
119119

120120
if (EG(windows_version_info).dwMajorVersion < 5) {
121121
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
20442044

20452045
#ifdef PHP_WIN32
20462046
/* Disable incompatible functions for the running platform */
2047-
if (php_win32_disable_functions() == FAILURE) {
2047+
if (php_win32_disable_functions(TSRMLS_C) == FAILURE) {
20482048
php_printf("Unable to disable unsupported functions\n");
20492049
return FAILURE;
20502050
}

sapi/apache/php_apache.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,14 +533,14 @@ PHP_FUNCTION(apache_lookup_uri)
533533

534534

535535
#if 0
536+
/*
536537
This function is most likely a bad idea. Just playing with it for now.
537-
538+
*/
538539
PHP_FUNCTION(apache_exec_uri)
539540
{
540541
char *filename;
541542
int filename_len;
542543
request_rec *rr=NULL;
543-
TSRMLS_FETCH();
544544

545545
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
546546
return;

0 commit comments

Comments
 (0)