Skip to content

Commit 65d031d

Browse files
committed
Use the TSRMLS_DC/TSRMLS_CC macros instead of TSRMLS_FETCH()
1 parent d6e772a commit 65d031d

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

sapi/cgi/cgi_main.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -587,14 +587,12 @@ static char *sapi_cgi_read_cookies(TSRMLS_D)
587587
return sapi_cgibin_getenv((char *) "HTTP_COOKIE", sizeof("HTTP_COOKIE")-1 TSRMLS_CC);
588588
}
589589

590-
static void cgi_php_load_env_var(char *var, unsigned int var_len, char *val, unsigned int val_len, void *arg)
590+
static void cgi_php_load_env_var(char *var, unsigned int var_len, char *val, unsigned int val_len, void *arg TSRMLS_DC)
591591
{
592592
zval *array_ptr = (zval*)arg;
593-
int filter_arg;
593+
int filter_arg = (array_ptr == PG(http_globals)[TRACK_VARS_ENV])?PARSE_ENV:PARSE_SERVER;
594594
unsigned int new_val_len;
595-
TSRMLS_FETCH();
596595

597-
filter_arg = (array_ptr == PG(http_globals)[TRACK_VARS_ENV])?PARSE_ENV:PARSE_SERVER;
598596
if (sapi_module.input_filter(filter_arg, var, &val, strlen(val), &new_val_len TSRMLS_CC)) {
599597
php_register_variable_safe(var, val, new_val_len, array_ptr TSRMLS_CC);
600598
}
@@ -633,7 +631,7 @@ void cgi_php_import_environment_variables(zval *array_ptr TSRMLS_DC)
633631

634632
/* turn off magic_quotes while importing environment variables */
635633
PG(magic_quotes_gpc) = 0;
636-
fcgi_loadenv(request, cgi_php_load_env_var, array_ptr);
634+
fcgi_loadenv(request, cgi_php_load_env_var, array_ptr TSRMLS_CC);
637635
PG(magic_quotes_gpc) = magic_quotes_gpc;
638636
}
639637
}

sapi/cgi/fastcgi.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,13 +322,13 @@ static char *fcgi_hash_get(fcgi_hash *h, char *var, unsigned int var_len, unsign
322322
return NULL;
323323
}
324324

325-
static void fcgi_hash_apply(fcgi_hash *h, fcgi_apply_func func, void *arg)
325+
static void fcgi_hash_apply(fcgi_hash *h, fcgi_apply_func func, void *arg TSRMLS_DC)
326326
{
327327
fcgi_hash_bucket *p = h->list;
328328

329329
while (p) {
330330
if (EXPECTED(p->val != NULL)) {
331-
func(p->var, p->var_len, p->val, p->val_len, arg);
331+
func(p->var, p->var_len, p->val, p->val_len, arg TSRMLS_CC);
332332
}
333333
p = p->list_next;
334334
}
@@ -848,7 +848,7 @@ static int fcgi_get_params(fcgi_request *req, unsigned char *p, unsigned char *e
848848
val_len |= *p++;
849849
}
850850
if (UNEXPECTED(name_len + val_len < 0) ||
851-
UNEXPECTED(name_len + val_len > end - p)) {
851+
UNEXPECTED((unsigned char *) (name_len + val_len) > end - p)) {
852852
/* Malformated request */
853853
ret = 0;
854854
break;
@@ -1435,9 +1435,9 @@ char* fcgi_putenv(fcgi_request *req, char* var, int var_len, char* val)
14351435
return NULL;
14361436
}
14371437

1438-
void fcgi_loadenv(fcgi_request *req, fcgi_apply_func func, zval *array)
1438+
void fcgi_loadenv(fcgi_request *req, fcgi_apply_func func, zval *array TSRMLS_DC)
14391439
{
1440-
fcgi_hash_apply(&req->env, func, array);
1440+
fcgi_hash_apply(&req->env, func, array TSRMLS_CC);
14411441
}
14421442

14431443
#ifdef _WIN32

sapi/cgi/fastcgi.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ typedef struct _fcgi_end_request_rec {
9191

9292
/* FastCGI client API */
9393

94-
typedef void (*fcgi_apply_func)(char *var, unsigned int var_len, char *val, unsigned int val_len, void *arg);
94+
typedef void (*fcgi_apply_func)(char *var, unsigned int var_len, char *val, unsigned int val_len, void *arg TSRMLS_DC);
9595

9696
typedef struct _fcgi_request fcgi_request;
9797

@@ -107,7 +107,7 @@ int fcgi_finish_request(fcgi_request *req, int force_close);
107107

108108
char* fcgi_getenv(fcgi_request *req, const char* var, int var_len);
109109
char* fcgi_putenv(fcgi_request *req, char* var, int var_len, char* val);
110-
void fcgi_loadenv(fcgi_request *req, fcgi_apply_func load_func, zval *array);
110+
void fcgi_loadenv(fcgi_request *req, fcgi_apply_func load_func, zval *array TSRMLS_DC);
111111

112112
int fcgi_read(fcgi_request *req, char *str, int len);
113113

0 commit comments

Comments
 (0)