diff options
author | Zeev Suraski <zeev@php.net> | 1999-04-24 00:12:00 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 1999-04-24 00:12:00 +0000 |
commit | 0818d96c97ceec4dbb8251c5220a2fdcdf39f355 (patch) | |
tree | c56f529e445e4bee928e7c28e0ccbb7f67572f16 /ext/standard | |
parent | 05d24c60223439b94d4100538331fb6749022ca3 (diff) | |
download | php-git-0818d96c97ceec4dbb8251c5220a2fdcdf39f355.tar.gz |
A lot of cleanups... Removed old thread-safe code and other redundant code and files
Diffstat (limited to 'ext/standard')
-rw-r--r-- | ext/standard/base64.c | 2 | ||||
-rw-r--r-- | ext/standard/basic_functions.c | 36 | ||||
-rw-r--r-- | ext/standard/browscap.c | 23 | ||||
-rw-r--r-- | ext/standard/datetime.c | 2 | ||||
-rw-r--r-- | ext/standard/dir.c | 30 | ||||
-rw-r--r-- | ext/standard/dl.c | 7 | ||||
-rw-r--r-- | ext/standard/dns.c | 8 | ||||
-rw-r--r-- | ext/standard/exec.c | 9 | ||||
-rw-r--r-- | ext/standard/file.c | 99 | ||||
-rw-r--r-- | ext/standard/filestat.c | 84 | ||||
-rw-r--r-- | ext/standard/formatted_print.c | 33 | ||||
-rw-r--r-- | ext/standard/fsock.c | 5 | ||||
-rw-r--r-- | ext/standard/head.c | 108 | ||||
-rw-r--r-- | ext/standard/html.c | 1 | ||||
-rw-r--r-- | ext/standard/image.c | 2 | ||||
-rw-r--r-- | ext/standard/info.c | 20 | ||||
-rw-r--r-- | ext/standard/mail.c | 1 | ||||
-rw-r--r-- | ext/standard/math.c | 10 | ||||
-rw-r--r-- | ext/standard/md5.c | 1 | ||||
-rw-r--r-- | ext/standard/microtime.c | 1 | ||||
-rw-r--r-- | ext/standard/mime.c | 2 | ||||
-rw-r--r-- | ext/standard/pack.c | 3 | ||||
-rw-r--r-- | ext/standard/pageinfo.c | 34 | ||||
-rw-r--r-- | ext/standard/post.c | 37 | ||||
-rw-r--r-- | ext/standard/reg.c | 5 | ||||
-rw-r--r-- | ext/standard/string.c | 62 | ||||
-rw-r--r-- | ext/standard/uniqid.c | 2 | ||||
-rw-r--r-- | ext/standard/url.c | 5 |
28 files changed, 260 insertions, 372 deletions
diff --git a/ext/standard/base64.c b/ext/standard/base64.c index 3099934764..fe52b79caf 100644 --- a/ext/standard/base64.c +++ b/ext/standard/base64.c @@ -144,7 +144,6 @@ void php3_base64_encode(INTERNAL_FUNCTION_PARAMETERS) { pval *string; unsigned char *result; int ret_length; - TLS_VARS; if (ARG_COUNT(ht)!=1 || getParameters(ht,1,&string) == FAILURE) { WRONG_PARAM_COUNT; @@ -168,7 +167,6 @@ void php3_base64_decode(INTERNAL_FUNCTION_PARAMETERS) { pval *string; unsigned char *result; int ret_length; - TLS_VARS; if (ARG_COUNT(ht)!=1 || getParameters(ht,1,&string) == FAILURE) { WRONG_PARAM_COUNT; diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 92d3d6bcff..d2ce463783 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -364,8 +364,7 @@ int php3_mshutdown_basic(SHUTDOWN_FUNC_ARGS) int php3_rinit_basic(INIT_FUNC_ARGS) { - TLS_VARS; - GLOBAL(strtok_string) = NULL; + strtok_string = NULL; #if HAVE_PUTENV if (_php3_hash_init(&putenv_ht, 1, NULL, (void (*)(void *)) _php3_putenv_destructor, 0) == FAILURE) { return FAILURE; @@ -379,8 +378,7 @@ int php3_rinit_basic(INIT_FUNC_ARGS) int php3_rshutdown_basic(SHUTDOWN_FUNC_ARGS) { - TLS_VARS; - STR_FREE(GLOBAL(strtok_string)); + STR_FREE(strtok_string); #if HAVE_PUTENV _php3_hash_destroy(&putenv_ht); #endif @@ -398,7 +396,6 @@ void php3_getenv(INTERNAL_FUNCTION_PARAMETERS) #endif pval *str; char *ptr; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) { WRONG_PARAM_COUNT; @@ -426,14 +423,14 @@ void php3_getenv(INTERNAL_FUNCTION_PARAMETERS) if (str->type == IS_STRING && #if APACHE - ((ptr = (char *)table_get(GLOBAL(php3_rqst)->subprocess_env, str->value.str.val)) || (ptr = getenv(str->value.str.val))) + ((ptr = (char *)table_get(php3_rqst->subprocess_env, str->value.str.val)) || (ptr = getenv(str->value.str.val))) #endif #if CGI_BINARY (ptr = getenv(str->value.str.val)) #endif #if USE_SAPI - (ptr = GLOBAL(sapi_rqst)->getenv(GLOBAL(sapi_rqst)->scid,str->value.str.val)) + (ptr = sapi_rqst->getenv(sapi_rqst->scid,str->value.str.val)) #endif #endif ) { @@ -448,7 +445,6 @@ void php3_putenv(INTERNAL_FUNCTION_PARAMETERS) { pval *str; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) { WRONG_PARAM_COUNT; @@ -523,7 +519,6 @@ void php3_toggle_short_open_tag(INTERNAL_FUNCTION_PARAMETERS) #if 0 pval *value; int ret; - TLS_VARS; ret = php3_ini.short_open_tag; @@ -621,7 +616,6 @@ void php3_key_sort(INTERNAL_FUNCTION_PARAMETERS) { pval *array; HashTable *target_hash; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) { WRONG_PARAM_COUNT; @@ -727,7 +721,6 @@ void php3_asort(INTERNAL_FUNCTION_PARAMETERS) { pval *array; HashTable *target_hash; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) { WRONG_PARAM_COUNT; @@ -751,7 +744,6 @@ void php3_arsort(INTERNAL_FUNCTION_PARAMETERS) { pval *array; HashTable *target_hash; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) { WRONG_PARAM_COUNT; @@ -775,7 +767,6 @@ void php3_sort(INTERNAL_FUNCTION_PARAMETERS) { pval *array; HashTable *target_hash; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) { WRONG_PARAM_COUNT; @@ -799,7 +790,6 @@ void php3_rsort(INTERNAL_FUNCTION_PARAMETERS) { pval *array; HashTable *target_hash; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) { WRONG_PARAM_COUNT; @@ -848,7 +838,6 @@ void php3_user_sort(INTERNAL_FUNCTION_PARAMETERS) pval *array; pval *old_compare_func; HashTable *target_hash; - TLS_VARS; old_compare_func = user_compare_func_name; if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &array, &user_compare_func_name) == FAILURE) { @@ -875,7 +864,6 @@ void php3_auser_sort(INTERNAL_FUNCTION_PARAMETERS) pval *array; pval *old_compare_func; HashTable *target_hash; - TLS_VARS; old_compare_func = user_compare_func_name; if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &array, &user_compare_func_name) == FAILURE) { @@ -950,7 +938,6 @@ void php3_user_key_sort(INTERNAL_FUNCTION_PARAMETERS) pval *array; pval *old_compare_func; HashTable *target_hash; - TLS_VARS; old_compare_func = user_compare_func_name; if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &array, &user_compare_func_name) == FAILURE) { @@ -1180,11 +1167,10 @@ void php3_flush(INTERNAL_FUNCTION_PARAMETERS) #endif { #if APACHE - TLS_VARS; # if MODULE_MAGIC_NUMBER > 19970110 - rflush(GLOBAL(php3_rqst)); + rflush(php3_rqst); # else - bflush(GLOBAL(php3_rqst)->connection->client); + bflush(php3_rqst->connection->client); # endif #endif #if FHTTPD @@ -1194,8 +1180,7 @@ void php3_flush(INTERNAL_FUNCTION_PARAMETERS) fflush(stdout); #endif #if USE_SAPI - TLS_VARS; - GLOBAL(sapi_rqst)->flush(GLOBAL(sapi_rqst)->scid); + sapi_rqst->flush(sapi_rqst->scid); #endif } @@ -1227,7 +1212,6 @@ void php3_usleep(INTERNAL_FUNCTION_PARAMETERS) void php3_gettype(INTERNAL_FUNCTION_PARAMETERS) { pval *arg; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) { WRONG_PARAM_COUNT; @@ -1270,7 +1254,6 @@ void php3_settype(INTERNAL_FUNCTION_PARAMETERS) { pval *var, *type; char *new_type; - TLS_VARS; if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &var, &type) == FAILURE) { @@ -1379,7 +1362,6 @@ static int _php3_array_walk(const void *a) void php3_array_walk(INTERNAL_FUNCTION_PARAMETERS) { pval *array, *old_walk_func_name; HashTable *target_hash; - TLS_VARS; old_walk_func_name = php3_array_walk_func_name; if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &array, &php3_array_walk_func_name) == FAILURE) { @@ -1404,7 +1386,6 @@ void php3_max(INTERNAL_FUNCTION_PARAMETERS) pval **argv; int argc, i; unsigned short max_type = IS_LONG; - TLS_VARS; argc = ARG_COUNT(ht); /* if there is one parameter and this parameter is an array of @@ -1469,8 +1450,6 @@ void php3_max(INTERNAL_FUNCTION_PARAMETERS) void php3_get_current_user(INTERNAL_FUNCTION_PARAMETERS) { - TLS_VARS; - RETURN_STRING(_php3_get_current_user(),1); } @@ -1576,7 +1555,6 @@ void php3_error_log(INTERNAL_FUNCTION_PARAMETERS) pval *string, *erropt = NULL, *option = NULL, *emailhead = NULL; int opt_err = 0; char *message, *opt=NULL, *headers=NULL; - TLS_VARS; switch(ARG_COUNT(ht)) { case 1: diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c index 3fe1500708..f6bc5e80a3 100644 --- a/ext/standard/browscap.c +++ b/ext/standard/browscap.c @@ -53,9 +53,8 @@ static int browser_reg_compare(pval *browser) { pval *browser_name; regex_t r; - TLS_VARS; - if (GLOBAL(found_browser_entry)) { /* already found */ + if (found_browser_entry) { /* already found */ return 0; } _php3_hash_find(browser->value.ht,"browser_name_pattern",sizeof("browser_name_pattern"),(void **) &browser_name); @@ -65,8 +64,8 @@ static int browser_reg_compare(pval *browser) if (regcomp(&r,browser_name->value.str.val,REG_NOSUB)!=0) { return 0; } - if (regexec(&r,GLOBAL(lookup_browser_name),0,NULL,0)==0) { - GLOBAL(found_browser_entry) = browser; + if (regexec(&r,lookup_browser_name,0,NULL,0)==0) { + found_browser_entry = browser; } regfree(&r); return 0; @@ -100,14 +99,14 @@ void php3_get_browser(INTERNAL_FUNCTION_PARAMETERS) convert_to_string(agent_name); - if (_php3_hash_find(&GLOBAL(browser_hash), agent_name->value.str.val, agent_name->value.str.len+1, (void **) &agent)==FAILURE) { - GLOBAL(lookup_browser_name) = agent_name->value.str.val; - GLOBAL(found_browser_entry) = NULL; - _php3_hash_apply(&GLOBAL(browser_hash),(int (*)(void *)) browser_reg_compare); + if (_php3_hash_find(&browser_hash, agent_name->value.str.val, agent_name->value.str.len+1, (void **) &agent)==FAILURE) { + lookup_browser_name = agent_name->value.str.val; + found_browser_entry = NULL; + _php3_hash_apply(&browser_hash,(int (*)(void *)) browser_reg_compare); - if (GLOBAL(found_browser_entry)) { - agent = GLOBAL(found_browser_entry); - } else if (_php3_hash_find(&GLOBAL(browser_hash), "Default Browser", sizeof("Default Browser"), (void **) &agent)==FAILURE) { + if (found_browser_entry) { + agent = found_browser_entry; + } else if (_php3_hash_find(&browser_hash, "Default Browser", sizeof("Default Browser"), (void **) &agent)==FAILURE) { RETURN_FALSE; } } @@ -118,7 +117,7 @@ void php3_get_browser(INTERNAL_FUNCTION_PARAMETERS) return_value->value.ht->pDestructor = PVAL_DESTRUCTOR; while (_php3_hash_find(agent->value.ht, "parent", sizeof("parent"), (void **) &agent_name)==SUCCESS) { - if (_php3_hash_find(&GLOBAL(browser_hash), agent_name->value.str.val, agent_name->value.str.len+1, (void **) &agent)==FAILURE) { + if (_php3_hash_find(&browser_hash, agent_name->value.str.val, agent_name->value.str.len+1, (void **) &agent)==FAILURE) { break; } _php3_hash_merge(return_value->value.ht,agent->value.ht,(void (*)(void *pData)) pval_copy_constructor, (void *) &tmp, sizeof(pval)); diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c index 3c0cf138b0..d697928f3f 100644 --- a/ext/standard/datetime.c +++ b/ext/standard/datetime.c @@ -153,7 +153,6 @@ _php3_date(INTERNAL_FUNCTION_PARAMETERS, int gm) struct tm *ta; int i, size = 0, length, h; char tmp_buff[16]; - TLS_VARS; switch(ARG_COUNT(ht)) { case 1: @@ -423,7 +422,6 @@ void php3_checkdate(INTERNAL_FUNCTION_PARAMETERS) { pval *month, *day, *year; int m, d, y; - TLS_VARS; if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &month, &day, &year) == FAILURE) { diff --git a/ext/standard/dir.c b/ext/standard/dir.c index 546f31554b..e50158202a 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -73,9 +73,7 @@ php3_module_entry php3_dir_module_entry = { int php3_minit_dir(INIT_FUNC_ARGS) { - TLS_VARS; - - GLOBAL(le_dirp) = register_list_destructors(closedir,NULL); + le_dirp = register_list_destructors(closedir,NULL); return SUCCESS; } @@ -86,7 +84,6 @@ void php3_opendir(INTERNAL_FUNCTION_PARAMETERS) pval *arg; DIR *dirp; int ret; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) { WRONG_PARAM_COUNT; @@ -101,8 +98,8 @@ void php3_opendir(INTERNAL_FUNCTION_PARAMETERS) php3_error(E_WARNING, "OpenDir: %s (errno %d)", strerror(errno),errno); RETURN_FALSE; } - ret = php3_list_insert(dirp, GLOBAL(le_dirp)); - GLOBAL(dirp_id) = ret; + ret = php3_list_insert(dirp, le_dirp); + dirp_id = ret; RETURN_LONG(ret); } /* }}} */ @@ -115,7 +112,6 @@ void php3_closedir(INTERNAL_FUNCTION_PARAMETERS) int id_to_find; DIR *dirp; int dirp_type; - TLS_VARS; if (ARG_COUNT(ht) == 0) { if (getThis(&id) == SUCCESS) { @@ -125,7 +121,7 @@ void php3_closedir(INTERNAL_FUNCTION_PARAMETERS) } id_to_find = tmp->value.lval; } else { - id_to_find = GLOBAL(dirp_id); + id_to_find = dirp_id; } } else if ((ARG_COUNT(ht) != 1) || getParameters(ht, 1, &id) == FAILURE) { WRONG_PARAM_COUNT; @@ -135,7 +131,7 @@ void php3_closedir(INTERNAL_FUNCTION_PARAMETERS) } dirp = (DIR *)php3_list_find(id_to_find, &dirp_type); - if (!dirp || dirp_type != GLOBAL(le_dirp)) { + if (!dirp || dirp_type != le_dirp) { php3_error(E_WARNING, "unable to find identifier (%d)", id_to_find); RETURN_FALSE; } @@ -149,7 +145,6 @@ void php3_chdir(INTERNAL_FUNCTION_PARAMETERS) { pval *arg; int ret; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) { WRONG_PARAM_COUNT; @@ -173,7 +168,6 @@ void php3_rewinddir(INTERNAL_FUNCTION_PARAMETERS) int id_to_find; DIR *dirp; int dirp_type; - TLS_VARS; if (ARG_COUNT(ht) == 0) { if (getThis(&id) == SUCCESS) { @@ -183,7 +177,7 @@ void php3_rewinddir(INTERNAL_FUNCTION_PARAMETERS) } id_to_find = tmp->value.lval; } else { - id_to_find = GLOBAL(dirp_id); + id_to_find = dirp_id; } } else if ((ARG_COUNT(ht) != 1) || getParameters(ht, 1, &id) == FAILURE) { WRONG_PARAM_COUNT; @@ -193,7 +187,7 @@ void php3_rewinddir(INTERNAL_FUNCTION_PARAMETERS) } dirp = (DIR *)php3_list_find(id_to_find, &dirp_type); - if (!dirp || dirp_type != GLOBAL(le_dirp)) { + if (!dirp || dirp_type != le_dirp) { php3_error(E_WARNING, "unable to find identifier (%d)", id_to_find); RETURN_FALSE; } @@ -210,7 +204,6 @@ void php3_readdir(INTERNAL_FUNCTION_PARAMETERS) DIR *dirp; int dirp_type; struct dirent *direntp; - TLS_VARS; if (ARG_COUNT(ht) == 0) { if (getThis(&id) == SUCCESS) { @@ -220,7 +213,7 @@ void php3_readdir(INTERNAL_FUNCTION_PARAMETERS) } id_to_find = tmp->value.lval; } else { - id_to_find = GLOBAL(dirp_id); + id_to_find = dirp_id; } } else if ((ARG_COUNT(ht) != 1) || getParameters(ht, 1, &id) == FAILURE) { WRONG_PARAM_COUNT; @@ -230,7 +223,7 @@ void php3_readdir(INTERNAL_FUNCTION_PARAMETERS) } dirp = (DIR *)php3_list_find(id_to_find, &dirp_type); - if (!dirp || dirp_type != GLOBAL(le_dirp)) { + if (!dirp || dirp_type != le_dirp) { php3_error(E_WARNING, "unable to find identifier (%d)", id_to_find); RETURN_FALSE; } @@ -248,7 +241,6 @@ void php3_getdir(INTERNAL_FUNCTION_PARAMETERS) { pval *arg; DIR *dirp; int ret; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) { WRONG_PARAM_COUNT; @@ -263,8 +255,8 @@ void php3_getdir(INTERNAL_FUNCTION_PARAMETERS) { php3_error(E_WARNING, "OpenDir: %s (errno %d)", strerror(errno), errno); RETURN_FALSE; } - ret = php3_list_insert(dirp, GLOBAL(le_dirp)); - GLOBAL(dirp_id) = ret; + ret = php3_list_insert(dirp, le_dirp); + dirp_id = ret; /* construct an object with some methods */ object_init(return_value); diff --git a/ext/standard/dl.c b/ext/standard/dl.c index 60ae23c2d6..7471634ab5 100644 --- a/ext/standard/dl.c +++ b/ext/standard/dl.c @@ -149,7 +149,7 @@ void php3_dl(pval *file,int type,pval *return_value) } /* update the .request_started property... */ - if (_php3_hash_find(&GLOBAL(module_registry),module_entry->name,strlen(module_entry->name)+1,(void **) &tmp)==FAILURE) { + if (_php3_hash_find(&module_registry,module_entry->name,strlen(module_entry->name)+1,(void **) &tmp)==FAILURE) { php3_error(E_ERROR,"%s: Loaded module got lost",module_entry->name); RETURN_FALSE; } @@ -159,8 +159,9 @@ void php3_dl(pval *file,int type,pval *return_value) RETURN_TRUE; } -void php3_info_dl(void){ - TLS_VARS; + +void php3_info_dl(void) +{ PUTS("Dynamic Library support enabled.\n"); } diff --git a/ext/standard/dns.c b/ext/standard/dns.c index 2bec92bb88..5f3a03ee0d 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -68,7 +68,6 @@ char *_php3_gethostbyname(char *name); void php3_gethostbyaddr(INTERNAL_FUNCTION_PARAMETERS) { pval *arg; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) { WRONG_PARAM_COUNT; @@ -108,7 +107,6 @@ char *_php3_gethostbyaddr(char *ip) void php3_gethostbyname(INTERNAL_FUNCTION_PARAMETERS) { pval *arg; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) { WRONG_PARAM_COUNT; @@ -129,7 +127,6 @@ void php3_gethostbynamel(INTERNAL_FUNCTION_PARAMETERS) struct hostent *hp; struct in_addr in; int i; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) { WRONG_PARAM_COUNT; @@ -185,7 +182,6 @@ void php3_checkdnsrr(INTERNAL_FUNCTION_PARAMETERS) #define MAXPACKET 8192 /* max packet size used internally by BIND */ #endif u_char ans[MAXPACKET]; - TLS_VARS; switch (ARG_COUNT(ht)) { case 1: @@ -270,7 +266,7 @@ void php3_getmxrr(INTERNAL_FUNCTION_PARAMETERS) RETURN_FALSE; } need_weight = 1; - pval_destructor(weight_list _INLINE_TLS); /* start with clean array */ + pval_destructor(weight_list); /* start with clean array */ if ( array_init(weight_list) == FAILURE ) { RETURN_FALSE; } @@ -280,7 +276,7 @@ void php3_getmxrr(INTERNAL_FUNCTION_PARAMETERS) } convert_to_string( host ); - pval_destructor(mx_list _INLINE_TLS); /* start with clean array */ + pval_destructor(mx_list); /* start with clean array */ if ( array_init(mx_list) == FAILURE ) { RETURN_FALSE; } diff --git a/ext/standard/exec.c b/ext/standard/exec.c index c4ea465c86..fe250c9985 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -111,7 +111,7 @@ static int _Exec(int type, char *cmd, pval *array, pval *return_value) buf[0] = '\0'; if (type==2) { if (array->type != IS_ARRAY) { - pval_destructor(array _INLINE_TLS); + pval_destructor(array); array_init(array); } } @@ -121,9 +121,9 @@ static int _Exec(int type, char *cmd, pval *array, pval *return_value) if (output) PUTS(buf); #if APACHE # if MODULE_MAGIC_NUMBER > 19970110 - if (output) rflush(GLOBAL(php3_rqst)); + if (output) rflush(php3_rqst); # else - if (output) bflush(GLOBAL(php3_rqst)->connection->client); + if (output) bflush(php3_rqst->connection->client); # endif #endif #if CGI_BINARY @@ -133,7 +133,7 @@ static int _Exec(int type, char *cmd, pval *array, pval *return_value) /* fhttpd doesn't flush */ #endif #if USE_SAPI - GLOBAL(sapi_rqst)->flush(GLOBAL(sapi_rqst)->scid); + sapi_rqst->flush(sapi_rqst->scid); #endif } else if (type == 2) { @@ -321,7 +321,6 @@ void php3_escapeshellcmd(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; char *cmd; - TLS_VARS; if (getParameters(ht, 1, &arg1) == FAILURE) { WRONG_PARAM_COUNT; diff --git a/ext/standard/file.c b/ext/standard/file.c index 5e34d73795..e36c386355 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -222,7 +222,6 @@ PHP_FUNCTION(flock) int issock=0; int *sock, fd=0; int act = 0; - TLS_VARS; if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { WRONG_PARAM_COUNT; @@ -232,13 +231,13 @@ PHP_FUNCTION(flock) convert_to_long(arg2); fp = php3_list_find(arg1->value.lval, &type); - if (type == GLOBAL(wsa_fp)){ + if (type == wsa_fp){ issock = 1; sock = php3_list_find(arg1->value.lval, &type); fd = *sock; } - if ((!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) && (!fd || type!=GLOBAL(wsa_fp))) { + if ((!fp || (type!=le_fp && type!=le_pp)) && (!fd || type!=wsa_fp)) { php3_error(E_WARNING,"Unable to find file identifier %d",arg1->value.lval); RETURN_FALSE; } @@ -467,7 +466,7 @@ void php3_file(INTERNAL_FUNCTION_PARAMETERS) static void __pclose(FILE *pipe) { - GLOBAL(pclose_ret) = pclose(pipe); + pclose_ret = pclose(pipe); } @@ -497,10 +496,10 @@ static void _php3_unlink_uploaded_file(char *file) int php3_minit_file(INIT_FUNC_ARGS) { - GLOBAL(le_fp) = register_list_destructors(fclose,NULL); - GLOBAL(le_pp) = register_list_destructors(__pclose,NULL); - GLOBAL(wsa_fp) = register_list_destructors(_php3_closesocket,NULL); - GLOBAL(le_uploads) = register_list_destructors(_php3_unlink_uploaded_file,NULL); + le_fp = register_list_destructors(fclose,NULL); + le_pp = register_list_destructors(__pclose,NULL); + wsa_fp = register_list_destructors(_php3_closesocket,NULL); + le_uploads = register_list_destructors(_php3_unlink_uploaded_file,NULL); return SUCCESS; } @@ -575,13 +574,13 @@ void php3_fopen(INTERNAL_FUNCTION_PARAMETERS) efree(p); RETURN_FALSE; } - GLOBAL(fgetss_state)=0; + fgetss_state=0; if (issock) { sock=emalloc(sizeof(int)); *sock=socketd; - id = php3_list_insert(sock,GLOBAL(wsa_fp)); + id = php3_list_insert(sock,wsa_fp); } else { - id = php3_list_insert(fp,GLOBAL(le_fp)); + id = php3_list_insert(fp,le_fp); } efree(p); RETURN_LONG(id); @@ -603,7 +602,7 @@ void php3_fclose(INTERNAL_FUNCTION_PARAMETERS) convert_to_long(arg1); id=arg1->value.lval; fp = php3_list_find(id,&type); - if (!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(wsa_fp))) { + if (!fp || (type!=le_fp && type!=wsa_fp)) { php3_error(E_WARNING,"Unable to find file identifier %d",id); RETURN_FALSE; } @@ -662,7 +661,7 @@ void php3_popen(INTERNAL_FUNCTION_PARAMETERS) RETURN_FALSE; } } - id = php3_list_insert(fp,GLOBAL(le_pp)); + id = php3_list_insert(fp,le_pp); efree(p); RETURN_LONG(id); } @@ -684,12 +683,12 @@ void php3_pclose(INTERNAL_FUNCTION_PARAMETERS) id = arg1->value.lval; fp = php3_list_find(id,&type); - if (!fp || type!=GLOBAL(le_pp)) { + if (!fp || type!=le_pp) { php3_error(E_WARNING,"Unable to find pipe identifier %d",id); RETURN_FALSE; } php3_list_delete(id); - RETURN_LONG(GLOBAL(pclose_ret)); + RETURN_LONG(pclose_ret); } /* }}} */ @@ -711,12 +710,12 @@ void php3_feof(INTERNAL_FUNCTION_PARAMETERS) convert_to_long(arg1); id = arg1->value.lval; fp = php3_list_find(id,&type); - if (type==GLOBAL(wsa_fp)){ + if (type==wsa_fp){ issock=1; sock = php3_list_find(id,&type); socketd=*sock; } - if ((!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) && (!socketd || type!=GLOBAL(wsa_fp))) { + if ((!fp || (type!=le_fp && type!=le_pp)) && (!socketd || type!=wsa_fp)) { php3_error(E_WARNING,"Unable to find file identifier %d",id); /* we're at the eof if the file doesn't exist */ RETURN_TRUE; @@ -748,7 +747,7 @@ void php3_set_socket_blocking(INTERNAL_FUNCTION_PARAMETERS) block = arg2->value.lval; sock = php3_list_find(id,&type); - if (type!=GLOBAL(wsa_fp)) { + if (type!=wsa_fp) { php3_error(E_WARNING,"%d is not a socket id",id); RETURN_FALSE; } @@ -807,7 +806,7 @@ void php3_set_socket_timeout(INTERNAL_FUNCTION_PARAMETERS) convert_to_long(timeout); sock = php3_list_find(socket->value.lval, &type); - if (type!=GLOBAL(wsa_fp)) { + if (type!=wsa_fp) { php3_error(E_WARNING,"%d is not a socket id",socket->value.lval); RETURN_FALSE; } @@ -841,12 +840,12 @@ void php3_fgets(INTERNAL_FUNCTION_PARAMETERS) len = arg2->value.lval; fp = php3_list_find(id,&type); - if (type==GLOBAL(wsa_fp)){ + if (type==wsa_fp){ issock=1; sock = php3_list_find(id,&type); socketd=*sock; } - if ((!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) && (!socketd || type!=GLOBAL(wsa_fp))) { + if ((!fp || (type!=le_fp && type!=le_pp)) && (!socketd || type!=wsa_fp)) { php3_error(E_WARNING,"Unable to find file identifier %d",id); RETURN_FALSE; } @@ -887,12 +886,12 @@ void php3_fgetc(INTERNAL_FUNCTION_PARAMETERS) { id = arg1->value.lval; fp = php3_list_find(id,&type); - if (type==GLOBAL(wsa_fp)){ + if (type==wsa_fp){ issock=1; sock = php3_list_find(id,&type); socketd = *sock; } - if ((!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) && (!socketd || type!=GLOBAL(wsa_fp))) { + if ((!fp || (type!=le_fp && type!=le_pp)) && (!socketd || type!=wsa_fp)) { php3_error(E_WARNING,"Unable to find file identifier %d",id); RETURN_FALSE; } @@ -934,12 +933,12 @@ void php3_fgetss(INTERNAL_FUNCTION_PARAMETERS) len = bytes->value.lval; fp = php3_list_find(id,&type); - if (type==GLOBAL(wsa_fp)){ + if (type==wsa_fp){ issock=1; sock = php3_list_find(id,&type); socketd=*sock; } - if ((!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) && (!socketd || type!=GLOBAL(wsa_fp))) { + if ((!fp || (type!=le_fp && type!=le_pp)) && (!socketd || type!=wsa_fp)) { php3_error(E_WARNING, "Unable to find file identifier %d", id); RETURN_FALSE; } @@ -962,67 +961,67 @@ void php3_fgetss(INTERNAL_FUNCTION_PARAMETERS) while (c) { switch (c) { case '<': - if (GLOBAL(fgetss_state) == 0) { + if (fgetss_state == 0) { lc = '<'; - GLOBAL(fgetss_state) = 1; + fgetss_state = 1; } break; case '(': - if (GLOBAL(fgetss_state) == 2) { + if (fgetss_state == 2) { if (lc != '\"') { lc = '('; br++; } - } else if (GLOBAL(fgetss_state) == 0) { + } else if (fgetss_state == 0) { *(rp++) = c; } break; case ')': - if (GLOBAL(fgetss_state) == 2) { + if (fgetss_state == 2) { if (lc != '\"') { lc = ')'; br--; } - } else if (GLOBAL(fgetss_state) == 0) { + } else if (fgetss_state == 0) { *(rp++) = c; } break; case '>': - if (GLOBAL(fgetss_state) == 1) { + if (fgetss_state == 1) { lc = '>'; - GLOBAL(fgetss_state) = 0; - } else if (GLOBAL(fgetss_state) == 2) { + fgetss_state = 0; + } else if (fgetss_state == 2) { if (!br && lc != '\"') { - GLOBAL(fgetss_state) = 0; + fgetss_state = 0; } } break; case '\"': - if (GLOBAL(fgetss_state) == 2) { + if (fgetss_state == 2) { if (lc == '\"') { lc = '\0'; } else if (lc != '\\') { lc = '\"'; } - } else if (GLOBAL(fgetss_state) == 0) { + } else if (fgetss_state == 0) { *(rp++) = c; } break; case '?': - if (GLOBAL(fgetss_state)==1) { + if (fgetss_state==1) { br=0; - GLOBAL(fgetss_state)=2; + fgetss_state=2; break; } /* fall-through */ default: - if (GLOBAL(fgetss_state) == 0) { + if (fgetss_state == 0) { *(rp++) = c; } } @@ -1073,12 +1072,12 @@ void php3_fwrite(INTERNAL_FUNCTION_PARAMETERS) id = arg1->value.lval; fp = php3_list_find(id,&type); - if (type==GLOBAL(wsa_fp)){ + if (type==wsa_fp){ issock=1; sock = php3_list_find(id,&type); socketd=*sock; } - if ((!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) && (!socketd || type!=GLOBAL(wsa_fp))) { + if ((!fp || (type!=le_fp && type!=le_pp)) && (!socketd || type!=wsa_fp)) { php3_error(E_WARNING,"Unable to find file identifier %d",id); RETURN_FALSE; } @@ -1112,7 +1111,7 @@ void php3_rewind(INTERNAL_FUNCTION_PARAMETERS) convert_to_long(arg1); id = arg1->value.lval; fp = php3_list_find(id,&type); - if (!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) { + if (!fp || (type!=le_fp && type!=le_pp)) { php3_error(E_WARNING,"Unable to find file identifier %d",id); RETURN_FALSE; } @@ -1137,7 +1136,7 @@ void php3_ftell(INTERNAL_FUNCTION_PARAMETERS) convert_to_long(arg1); id = arg1->value.lval; fp = php3_list_find(id,&type); - if (!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) { + if (!fp || (type!=le_fp && type!=le_pp)) { php3_error(E_WARNING,"Unable to find file identifier %d",id); RETURN_FALSE; } @@ -1164,7 +1163,7 @@ void php3_fseek(INTERNAL_FUNCTION_PARAMETERS) pos = arg2->value.lval; id = arg1->value.lval; fp = php3_list_find(id,&type); - if (!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) { + if (!fp || (type!=le_fp && type!=le_pp)) { php3_error(E_WARNING,"Unable to find file identifier %d",id); RETURN_FALSE; } @@ -1342,12 +1341,12 @@ void php3_fpassthru(INTERNAL_FUNCTION_PARAMETERS) convert_to_long(arg1); id = arg1->value.lval; fp = php3_list_find(id,&type); - if (type==GLOBAL(wsa_fp)){ + if (type==wsa_fp){ issock=1; sock = php3_list_find(id,&type); socketd=*sock; } - if ((!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) && (!socketd || type!=GLOBAL(wsa_fp))) { + if ((!fp || (type!=le_fp && type!=le_pp)) && (!socketd || type!=wsa_fp)) { php3_error(E_WARNING,"Unable to find file identifier %d",id); RETURN_FALSE; } @@ -1485,12 +1484,12 @@ void php3_fread(INTERNAL_FUNCTION_PARAMETERS) len = arg2->value.lval; fp = php3_list_find(id,&type); - if (type==GLOBAL(wsa_fp)){ + if (type==wsa_fp){ issock=1; sock = php3_list_find(id,&type); socketd=*sock; } - if ((!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) && (!socketd || type!=GLOBAL(wsa_fp))) { + if ((!fp || (type!=le_fp && type!=le_pp)) && (!socketd || type!=wsa_fp)) { php3_error(E_WARNING,"Unable to find file identifier %d",id); RETURN_FALSE; } @@ -1514,7 +1513,7 @@ void php3_fread(INTERNAL_FUNCTION_PARAMETERS) /* aparently needed for pdf to be compiled as a module under windows */ PHPAPI int php3i_get_le_fp(void) { - return GLOBAL(le_fp); + return le_fp; } /* diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index bd539e1d5d..b956b3346f 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -97,16 +97,16 @@ static struct stat lsb; int php3_init_filestat(INIT_FUNC_ARGS) { - GLOBAL(CurrentStatFile)=NULL; - GLOBAL(CurrentStatLength)=0; + CurrentStatFile=NULL; + CurrentStatLength=0; return SUCCESS; } int php3_shutdown_filestat(SHUTDOWN_FUNC_ARGS) { - if (GLOBAL(CurrentStatFile)) { - efree (GLOBAL(CurrentStatFile)); + if (CurrentStatFile) { + efree (CurrentStatFile); } return SUCCESS; } @@ -294,35 +294,35 @@ void php3_touch(INTERNAL_FUNCTION_PARAMETERS) void php3_clearstatcache(INTERNAL_FUNCTION_PARAMETERS) { - if (GLOBAL(CurrentStatFile)) { - efree(GLOBAL(CurrentStatFile)); - GLOBAL(CurrentStatFile) = NULL; + if (CurrentStatFile) { + efree(CurrentStatFile); + CurrentStatFile = NULL; } } static void _php3_stat(const char *filename, int type, pval *return_value) { - struct stat *stat_sb = &GLOBAL(sb); - - if (!GLOBAL(CurrentStatFile) || strcmp(filename,GLOBAL(CurrentStatFile))) { - if (!GLOBAL(CurrentStatFile) - || strlen(filename) > GLOBAL(CurrentStatLength)) { - if (GLOBAL(CurrentStatFile)) efree(GLOBAL(CurrentStatFile)); - GLOBAL(CurrentStatLength) = strlen(filename); - GLOBAL(CurrentStatFile) = estrndup(filename,GLOBAL(CurrentStatLength)); + struct stat *stat_sb = &sb; + + if (!CurrentStatFile || strcmp(filename,CurrentStatFile)) { + if (!CurrentStatFile + || strlen(filename) > CurrentStatLength) { + if (CurrentStatFile) efree(CurrentStatFile); + CurrentStatLength = strlen(filename); + CurrentStatFile = estrndup(filename,CurrentStatLength); } else { - strcpy(GLOBAL(CurrentStatFile),filename); + strcpy(CurrentStatFile,filename); } #if HAVE_SYMLINK - GLOBAL(lsb).st_mode = 0; /* mark lstat buf invalid */ + lsb.st_mode = 0; /* mark lstat buf invalid */ #endif - if (stat(GLOBAL(CurrentStatFile),&GLOBAL(sb))==-1) { + if (stat(CurrentStatFile,&sb)==-1) { if (type != 15 || errno != ENOENT) { /* fileexists() test must print no error */ - php3_error(E_NOTICE,"stat failed for %s (errno=%d - %s)",GLOBAL(CurrentStatFile),errno,strerror(errno)); + php3_error(E_NOTICE,"stat failed for %s (errno=%d - %s)",CurrentStatFile,errno,strerror(errno)); } - efree(GLOBAL(CurrentStatFile)); - GLOBAL(CurrentStatFile)=NULL; + efree(CurrentStatFile); + CurrentStatFile=NULL; RETURN_FALSE; } } @@ -334,9 +334,9 @@ static void _php3_stat(const char *filename, int type, pval *return_value) /* do lstat if the buffer is empty */ - if (!GLOBAL(lsb).st_mode) { - if (lstat(GLOBAL(CurrentStatFile),&GLOBAL(lsb)) == -1) { - php3_error(E_NOTICE,"lstat failed for %s (errno=%d - %s)",GLOBAL(CurrentStatFile),errno,strerror(errno)); + if (!lsb.st_mode) { + if (lstat(CurrentStatFile,&lsb) == -1) { + php3_error(E_NOTICE,"lstat failed for %s (errno=%d - %s)",CurrentStatFile,errno,strerror(errno)); RETURN_FALSE; } } @@ -345,49 +345,49 @@ static void _php3_stat(const char *filename, int type, pval *return_value) switch(type) { case 0: /* fileperms */ - RETURN_LONG((long)GLOBAL(sb).st_mode); + RETURN_LONG((long)sb.st_mode); case 1: /* fileinode */ - RETURN_LONG((long)GLOBAL(sb).st_ino); + RETURN_LONG((long)sb.st_ino); case 2: /* filesize */ - RETURN_LONG((long)GLOBAL(sb).st_size); + RETURN_LONG((long)sb.st_size); case 3: /* fileowner */ - RETURN_LONG((long)GLOBAL(sb).st_uid); + RETURN_LONG((long)sb.st_uid); case 4: /* filegroup */ - RETURN_LONG((long)GLOBAL(sb).st_gid); + RETURN_LONG((long)sb.st_gid); case 5: /* fileatime */ - RETURN_LONG((long)GLOBAL(sb).st_atime); + RETURN_LONG((long)sb.st_atime); case 6: /* filemtime */ - RETURN_LONG((long)GLOBAL(sb).st_mtime); + RETURN_LONG((long)sb.st_mtime); case 7: /* filectime */ - RETURN_LONG((long)GLOBAL(sb).st_ctime); + RETURN_LONG((long)sb.st_ctime); case 8: /* filetype */ #if HAVE_SYMLINK - if (S_ISLNK(GLOBAL(lsb).st_mode)) { + if (S_ISLNK(lsb.st_mode)) { RETURN_STRING("link",1); } #endif - switch(GLOBAL(sb).st_mode&S_IFMT) { + switch(sb.st_mode&S_IFMT) { case S_IFIFO: RETURN_STRING("fifo",1); case S_IFCHR: RETURN_STRING("char",1); case S_IFDIR: RETURN_STRING("dir",1); case S_IFBLK: RETURN_STRING("block",1); case S_IFREG: RETURN_STRING("file",1); } - php3_error(E_WARNING,"Unknown file type (%d)",GLOBAL(sb).st_mode&S_IFMT); + php3_error(E_WARNING,"Unknown file type (%d)",sb.st_mode&S_IFMT); RETURN_STRING("unknown",1); case 9: /*is writable*/ - RETURN_LONG((GLOBAL(sb).st_mode&S_IWRITE)!=0); + RETURN_LONG((sb.st_mode&S_IWRITE)!=0); case 10: /*is readable*/ - RETURN_LONG((GLOBAL(sb).st_mode&S_IREAD)!=0); + RETURN_LONG((sb.st_mode&S_IREAD)!=0); case 11: /*is executable*/ - RETURN_LONG((GLOBAL(sb).st_mode&S_IEXEC)!=0 && !S_ISDIR(GLOBAL(sb).st_mode)); + RETURN_LONG((sb.st_mode&S_IEXEC)!=0 && !S_ISDIR(sb.st_mode)); case 12: /*is file*/ - RETURN_LONG(S_ISREG(GLOBAL(sb).st_mode)); + RETURN_LONG(S_ISREG(sb.st_mode)); case 13: /*is dir*/ - RETURN_LONG(S_ISDIR(GLOBAL(sb).st_mode)); + RETURN_LONG(S_ISDIR(sb.st_mode)); case 14: /*is link*/ #if HAVE_SYMLINK - RETURN_LONG(S_ISLNK(GLOBAL(lsb).st_mode)); + RETURN_LONG(S_ISLNK(lsb.st_mode)); #else RETURN_FALSE; #endif @@ -395,7 +395,7 @@ static void _php3_stat(const char *filename, int type, pval *return_value) RETURN_TRUE; /* the false case was done earlier */ case 16: /* lstat */ #if HAVE_SYMLINK - stat_sb = &GLOBAL(lsb); + stat_sb = &lsb; #endif /* FALLTHROUGH */ case 17: /* stat */ diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index 4efb949292..094c29c8d6 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -79,30 +79,29 @@ _php3_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag) #ifndef THREAD_SAFE static char cvt_buf[NDIG]; #endif - TLS_VARS; if (ndigits >= NDIG - 1) ndigits = NDIG - 2; r2 = 0; *sign = 0; - p = &STATIC(cvt_buf)[0]; + p = &cvt_buf[0]; if (arg < 0) { *sign = 1; arg = -arg; } arg = modf(arg, &fi); - p1 = &STATIC(cvt_buf)[NDIG]; + p1 = &cvt_buf[NDIG]; /* * Do integer part */ if (fi != 0) { - p1 = &STATIC(cvt_buf)[NDIG]; + p1 = &cvt_buf[NDIG]; while (fi != 0) { fj = modf(fi / 10, &fi); *--p1 = (int) ((fj + .03) * 10) + '0'; r2++; } - while (p1 < &STATIC(cvt_buf)[NDIG]) + while (p1 < &cvt_buf[NDIG]) *p++ = *p1++; } else if (arg > 0) { while ((fj = arg * 10) < 1) { @@ -110,41 +109,41 @@ _php3_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag) r2--; } } - p1 = &STATIC(cvt_buf)[ndigits]; + p1 = &cvt_buf[ndigits]; if (eflag == 0) p1 += r2; *decpt = r2; - if (p1 < &STATIC(cvt_buf)[0]) { - STATIC(cvt_buf)[0] = '\0'; - return (STATIC(cvt_buf)); + if (p1 < &cvt_buf[0]) { + cvt_buf[0] = '\0'; + return (cvt_buf); } - while (p <= p1 && p < &STATIC(cvt_buf)[NDIG]) { + while (p <= p1 && p < &cvt_buf[NDIG]) { arg *= 10; arg = modf(arg, &fj); *p++ = (int) fj + '0'; } - if (p1 >= &STATIC(cvt_buf)[NDIG]) { - STATIC(cvt_buf)[NDIG - 1] = '\0'; - return (STATIC(cvt_buf)); + if (p1 >= &cvt_buf[NDIG]) { + cvt_buf[NDIG - 1] = '\0'; + return (cvt_buf); } p = p1; *p1 += 5; while (*p1 > '9') { *p1 = '0'; - if (p1 > STATIC(cvt_buf)) + if (p1 > cvt_buf) ++ * --p1; else { *p1 = '1'; (*decpt)++; if (eflag == 0) { - if (p > STATIC(cvt_buf)) + if (p > cvt_buf) *p = '0'; p++; } } } *p = '\0'; - return (STATIC(cvt_buf)); + return (cvt_buf); } @@ -567,7 +566,6 @@ PHP_FUNCTION(user_sprintf) { char *result; int len; - TLS_VARS; if ((result=php3_formatted_print(ht,&len))==NULL) { RETURN_FALSE; @@ -581,7 +579,6 @@ PHP_FUNCTION(user_printf) { char *result; int len; - TLS_VARS; if ((result=php3_formatted_print(ht,&len))==NULL) { RETURN_FALSE; diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c index c699136ceb..1c161468ef 100644 --- a/ext/standard/fsock.c +++ b/ext/standard/fsock.c @@ -154,7 +154,6 @@ static void _php3_fsockopen(INTERNAL_FUNCTION_PARAMETERS, int persistent) { int socketd = -1; unsigned short portno; char *key = NULL; - TLS_VARS; if (arg_count > 4 || arg_count < 2 || getParametersArray(ht,arg_count,args)==FAILURE) { FREE_SOCK; @@ -189,7 +188,7 @@ static void _php3_fsockopen(INTERNAL_FUNCTION_PARAMETERS, int persistent) { (void *) &sockp) == SUCCESS) { efree(key); *sock = *sockp; - RETURN_LONG(php3_list_insert(sock, GLOBAL(wsa_fp))); + RETURN_LONG(php3_list_insert(sock, wsa_fp)); } if (portno) { @@ -266,7 +265,7 @@ static void _php3_fsockopen(INTERNAL_FUNCTION_PARAMETERS, int persistent) { key, strlen(key) + 1, NULL); } if(key) efree(key); - id = php3_list_insert(sock,GLOBAL(wsa_fp)); + id = php3_list_insert(sock,wsa_fp); RETURN_LONG(id); } /* }}} */ diff --git a/ext/standard/head.c b/ext/standard/head.c index 3b34ff8587..ab8eb483d6 100644 --- a/ext/standard/head.c +++ b/ext/standard/head.c @@ -58,21 +58,19 @@ CookieList *php3_PopCookieList(void); int php3_init_head(INIT_FUNC_ARGS) { - TLS_VARS; - GLOBAL(php3_HeaderPrinted) = 0; - if (GLOBAL(header_called) == 0) - GLOBAL(php3_PrintHeader) = 1; - GLOBAL(top) = NULL; - GLOBAL(cont_type) = NULL; + php3_HeaderPrinted = 0; + if (header_called == 0) + php3_PrintHeader = 1; + top = NULL; + cont_type = NULL; return SUCCESS; } void php3_noheader(void) { - TLS_VARS; - GLOBAL(php3_PrintHeader) = 0; - GLOBAL(header_called) = 1; + php3_PrintHeader = 0; + header_called = 1; } @@ -87,7 +85,7 @@ void php4i_add_header_information(char *header_information) char temp2[32]; #endif - if (GLOBAL(php3_HeaderPrinted) == 1) { + if (php3_HeaderPrinted == 1) { #if DEBUG php3_error(E_WARNING, "Cannot add more header information - the header was already sent " "(header information may be added only before any output is generated from the script - " @@ -105,10 +103,10 @@ void php4i_add_header_information(char *header_information) *r = '\0'; if (!strcasecmp(header_information, "Content-type")) { if (*(r + 1) == ' ') - GLOBAL(php3_rqst)->content_type = pstrdup(GLOBAL(php3_rqst)->pool,r + 2); + php3_rqst->content_type = pstrdup(php3_rqst->pool,r + 2); else - GLOBAL(php3_rqst)->content_type = pstrdup(GLOBAL(php3_rqst)->pool,r + 1); - GLOBAL(cont_type) = (char *)GLOBAL(php3_rqst)->content_type; + php3_rqst->content_type = pstrdup(php3_rqst->pool,r + 1); + cont_type = (char *)php3_rqst->content_type; } else { if (*(r + 1) == ' ') { rr = r + 2; @@ -127,36 +125,36 @@ void php4i_add_header_information(char *header_information) temp = _php3_regreplace("$", temp2, rr, 0, 0); } } - table_set(GLOBAL(php3_rqst)->headers_out, header_information, temp); + table_set(php3_rqst->headers_out, header_information, temp); } else - table_set(GLOBAL(php3_rqst)->headers_out, header_information, rr); + table_set(php3_rqst->headers_out, header_information, rr); } if (!strcasecmp(header_information, "location")) { - GLOBAL(php3_rqst)->status = REDIRECT; + php3_rqst->status = REDIRECT; } *r = ':'; - GLOBAL(php3_HeaderPrinted) = 2; + php3_HeaderPrinted = 2; } if (!strncasecmp(header_information, "http/", 5)) { if (strlen(header_information) > 9) { - GLOBAL(php3_rqst)->status = atoi(&((header_information)[9])); + php3_rqst->status = atoi(&((header_information)[9])); } /* Use a pstrdup here to get the memory straight from Apache's per-request pool to * avoid having our own memory manager complain about this memory not being freed * because it really shouldn't be freed until the end of the request and it isn't * easy for us to figure out when we allocated it vs. when something else might have. */ - GLOBAL(php3_rqst)->status_line = pstrdup(GLOBAL(php3_rqst)->pool,&((header_information)[9])); + php3_rqst->status_line = pstrdup(php3_rqst->pool,&((header_information)[9])); } #else r = strchr(header_information, ':'); if (r) { *r = '\0'; if (!strcasecmp(header_information, "Content-type")) { - if (GLOBAL(cont_type)) efree(GLOBAL(cont_type)); - GLOBAL(cont_type) = estrdup(r + 1); + if (cont_type) efree(cont_type); + cont_type = estrdup(r + 1); #if 0 /*WIN32|WINNT / *M$ does us again*/ - if (!strcmp(GLOBAL(cont_type)," text/html")){ + if (!strcmp(cont_type," text/html")){ *r=':'; PUTS_H(header_information); PUTS_H("\015\012"); @@ -169,7 +167,7 @@ void php4i_add_header_information(char *header_information) char *tempstr=emalloc(strlen(header_information)+2); sprintf(tempstr,"%s\015\012",tempstr); - GLOBAL(sapi_rqst)->header(GLOBAL(sapi_rqst)->scid,tempstr); + sapi_rqst->header(sapi_rqst->scid,tempstr); efree(tempstr); } #elif FHTTPD @@ -185,7 +183,7 @@ void php4i_add_header_information(char *header_information) { char *tempstr=emalloc(strlen(header_information)+2); sprintf(tempstr,"%s\015\012",tempstr); - GLOBAL(sapi_rqst)->header(GLOBAL(sapi_rqst)->scid,tempstr); + sapi_rqst->header(sapi_rqst->scid,tempstr); efree(tempstr); } #elif FHTTPD @@ -245,11 +243,11 @@ PHPAPI int php3_header(void) } #if APACHE - if (!GLOBAL(php3_rqst)) { /* we're not in a request, allow output */ + if (!php3_rqst) { /* we're not in a request, allow output */ PG(header_is_being_sent) = 0; return 1; } - if ((GLOBAL(php3_PrintHeader) && !GLOBAL(php3_HeaderPrinted)) || (GLOBAL(php3_PrintHeader) && GLOBAL(php3_HeaderPrinted) == 2)) { + if ((php3_PrintHeader && !php3_HeaderPrinted) || (php3_PrintHeader && php3_HeaderPrinted == 2)) { cookie = php3_PopCookieList(); while (cookie) { if (cookie->name) @@ -306,7 +304,7 @@ PHPAPI int php3_header(void) if (cookie->secure) { strcat(tempstr, "; secure"); } - table_add(GLOBAL(php3_rqst)->headers_out, "Set-Cookie", tempstr); + table_add(php3_rqst->headers_out, "Set-Cookie", tempstr); if (cookie->domain) efree(cookie->domain); if (cookie->path) efree(cookie->path); if (cookie->name) efree(cookie->name); @@ -316,20 +314,20 @@ PHPAPI int php3_header(void) cookie = php3_PopCookieList(); efree(tempstr); } - GLOBAL(php3_HeaderPrinted) = 1; - GLOBAL(header_called) = 1; - send_http_header(GLOBAL(php3_rqst)); - if (GLOBAL(php3_rqst)->header_only) { + php3_HeaderPrinted = 1; + header_called = 1; + send_http_header(php3_rqst); + if (php3_rqst->header_only) { set_header_request(1); PG(header_is_being_sent) = 0; return(0); } } #else - if (GLOBAL(php3_PrintHeader) && !GLOBAL(php3_HeaderPrinted)) { - if (!GLOBAL(cont_type)) { + if (php3_PrintHeader && !php3_HeaderPrinted) { + if (!cont_type) { #if USE_SAPI - GLOBAL(sapi_rqst)->header(GLOBAL(sapi_rqst)->scid,"Content-type: text/html\015\012\015\012"); + sapi_rqst->header(sapi_rqst->scid,"Content-type: text/html\015\012\015\012"); #elif FHTTPD php3_fhttpd_puts_header("Content-type: text/html\r\n"); #else @@ -337,30 +335,30 @@ PHPAPI int php3_header(void) #endif } else { #if 0 /*WIN32|WINNT / *M$ does us again*/ - if (!strcmp(GLOBAL(cont_type),"text/html")){ + if (!strcmp(cont_type,"text/html")){ #endif #if USE_SAPI - tempstr=emalloc(strlen(GLOBAL(cont_type))+18); - sprintf(tempstr,"Content-type: %s\015\012\015\012",GLOBAL(cont_type)); - GLOBAL(sapi_rqst)->header(GLOBAL(sapi_rqst)->scid,tempstr); + tempstr=emalloc(strlen(cont_type)+18); + sprintf(tempstr,"Content-type: %s\015\012\015\012",cont_type); + sapi_rqst->header(sapi_rqst->scid,tempstr); efree(tempstr); #elif FHTTPD - tempstr = emalloc(strlen(GLOBAL(cont_type)) + tempstr = emalloc(strlen(cont_type) + sizeof("Content-type:") + 2); if(tempstr) { strcpy(tempstr, "Content-type:"); strcpy(tempstr + sizeof("Content-type:") - 1, - GLOBAL(cont_type)); + cont_type); strcat(tempstr, "\r\n"); php3_fhttpd_puts_header(tempstr); efree(tempstr); } #else PUTS_H("Content-type:"); - PUTS_H(GLOBAL(cont_type)); + PUTS_H(cont_type); PUTS_H("\015\012\015\012"); #endif - efree(GLOBAL(cont_type)); + efree(cont_type); #if 0 /*WIN32|WINNT / *M$ does us again*/ } else { PUTS_H("\015\012"); @@ -368,12 +366,12 @@ PHPAPI int php3_header(void) #endif } #if USE_SAPI - GLOBAL(sapi_rqst)->flush(GLOBAL(sapi_rqst)->scid); + sapi_rqst->flush(sapi_rqst->scid); #else fflush(stdout); #endif - GLOBAL(php3_HeaderPrinted) = 1; - GLOBAL(header_called) = 1; + php3_HeaderPrinted = 1; + header_called = 1; } #endif PG(header_is_being_sent) = 0; @@ -383,27 +381,25 @@ PHPAPI int php3_header(void) void php3_PushCookieList(char *name, char *value, time_t expires, char *path, char *domain, int secure) { CookieList *new; - TLS_VARS; new = emalloc(sizeof(CookieList)); - new->next = GLOBAL(top); + new->next = top; new->name = name; new->value = value; new->expires = expires; new->path = path; new->domain = domain; new->secure = secure; - GLOBAL(top) = new; + top = new; } CookieList *php3_PopCookieList(void) { CookieList *ret; - TLS_VARS; - ret = GLOBAL(top); - if (GLOBAL(top)) - GLOBAL(top) = GLOBAL(top)->next; + ret = top; + if (top) + top = top->next; return (ret); } @@ -424,13 +420,12 @@ void php3_SetCookie(INTERNAL_FUNCTION_PARAMETERS) int secure = 0; pval *arg[6]; int arg_count; - TLS_VARS; arg_count = ARG_COUNT(ht); if (arg_count < 1 || arg_count > 6 || getParametersArray(ht, arg_count, arg) == FAILURE) { WRONG_PARAM_COUNT; } - if (GLOBAL(php3_HeaderPrinted) == 1) { + if (php3_HeaderPrinted == 1) { php3_error(E_WARNING, "Oops, php3_SetCookie called after header has been sent\n"); return; } @@ -509,7 +504,7 @@ void php3_SetCookie(INTERNAL_FUNCTION_PARAMETERS) { char *tempstr2=emalloc(strlen(tempstr)+14); sprintf(tempstr2,"Set-Cookie: %s\015\012",tempstr); - GLOBAL(sapi_rqst)->header(GLOBAL(sapi_rqst)->scid,tempstr2); + sapi_rqst->header(sapi_rqst->scid,tempstr2); efree(tempstr2); } #elif FHTTPD @@ -538,8 +533,7 @@ void php3_SetCookie(INTERNAL_FUNCTION_PARAMETERS) int php3_headers_unsent(void) { - TLS_VARS; - if (GLOBAL(php3_HeaderPrinted)!=1 || !GLOBAL(php3_PrintHeader)) { + if (php3_HeaderPrinted!=1 || !php3_PrintHeader) { return 1; } else { return 0; diff --git a/ext/standard/html.c b/ext/standard/html.c index 49baf94b41..db4c4364f6 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -60,7 +60,6 @@ static void _php3_htmlentities(INTERNAL_FUNCTION_PARAMETERS, int all) int i, len, maxlen; unsigned char *old; char *new; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) { WRONG_PARAM_COUNT; diff --git a/ext/standard/image.c b/ext/standard/image.c index a91607f3e7..f5400550e0 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -331,7 +331,7 @@ void php3_getimagesize(INTERNAL_FUNCTION_PARAMETERS) RETURN_FALSE; } - pval_destructor(info _INLINE_TLS); + pval_destructor(info); if (array_init(info) == FAILURE) { return; } diff --git a/ext/standard/info.c b/ext/standard/info.c index cfcf15a06c..ea90416530 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -106,7 +106,7 @@ void _php3_info(void) PUTS("<img src=\""); - /*PUTS(GLOBAL(php3_rqst)->uri);*/ + /*PUTS(php3_rqst->uri);*/ PUTS("?=PHPE9568F34-D428-11d2-A769-00AA001ACF42\" border=\"0\" width=\"100\" height=\"56\" align=\"right\">\n"); php3_printf("<center><h1>PHP Version %s</h1></center>\n", PHP_VERSION); PUTS("<p>by <a href=\"mailto:rasmus@lerdorf.on.ca\">Rasmus Lerdorf</a>,\n"); @@ -134,7 +134,7 @@ void _php3_info(void) PUTS("HSREGEX=" PHP_HSREGEX "</td></tr>\n"); #endif - _php3_hash_apply(&GLOBAL(module_registry),(int (*)(void *))_display_module_info); + _php3_hash_apply(&module_registry,(int (*)(void *))_display_module_info); PUTS("</table>\n"); SECTION("Configuration"); @@ -196,7 +196,7 @@ void _php3_info(void) PUTS("</table>"); #if USE_SAPI /* call a server module specific info function */ - GLOBAL(sapi_rqst)->info(GLOBAL(sapi_rqst)); + sapi_rqst->info(sapi_rqst); #endif SECTION("Environment"); @@ -323,7 +323,7 @@ void _php3_info(void) #if APACHE { register int i; - array_header *arr = table_elts(GLOBAL(php3_rqst)->subprocess_env); + array_header *arr = table_elts(php3_rqst->subprocess_env); table_entry *elts = (table_entry *)arr->elts; SECTION("Apache Environment"); @@ -350,9 +350,9 @@ void _php3_info(void) PUTS("<table border=5 width=\"600\">\n"); PUTS(" <tr><th colspan=2 bgcolor=\"" HEADER_COLOR "\">HTTP Request Headers</th></tr>\n"); PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">HTTP Request</td><td bgcolor=\"" CONTENTS_COLOR "\">"); - PUTS(GLOBAL(php3_rqst)->the_request); + PUTS(php3_rqst->the_request); PUTS(" </td></tr>\n"); - env_arr = table_elts(GLOBAL(php3_rqst)->headers_in); + env_arr = table_elts(php3_rqst->headers_in); env = (table_entry *)env_arr->elts; for (i = 0; i < env_arr->nelts; ++i) { if (env[i].key) { @@ -364,7 +364,7 @@ void _php3_info(void) } } PUTS(" <tr><th colspan=2 bgcolor=\"" HEADER_COLOR "\">HTTP Response Headers</th></tr>\n"); - env_arr = table_elts(GLOBAL(php3_rqst)->headers_out); + env_arr = table_elts(php3_rqst->headers_out); env = (table_entry *)env_arr->elts; for(i = 0; i < env_arr->nelts; ++i) { if (env[i].key) { @@ -385,7 +385,7 @@ void _php3_info(void) PUTS("<table width=\"100%%\"><tr>\n"); php3_printf("<td><h2>Zend</h2>This program makes use of the Zend scripting language engine:<br><pre>%s</pre></td>", get_zend_version()); PUTS("<td width=\"100\"><a href=\"http://www.zend.com/\"><img src=\""); - /*PUTS(GLOBAL(php3_rqst)->uri);*/ + /*PUTS(php3_rqst->uri);*/ PUTS("?=PHPE9568F35-D428-11d2-A769-00AA001ACF42\" border=\"0\" width=\"100\" height=\"89\"></a></td>\n"); PUTS("</tr></table>\n"); @@ -415,8 +415,6 @@ void _php3_info(void) Output a page of useful information about PHP and the current request */ void php3_info(INTERNAL_FUNCTION_PARAMETERS) { - TLS_VARS; - _php3_info(); RETURN_TRUE; } @@ -426,8 +424,6 @@ void php3_info(INTERNAL_FUNCTION_PARAMETERS) Return the current PHP version */ void php3_version(INTERNAL_FUNCTION_PARAMETERS) { - TLS_VARS; - RETURN_STRING(PHP_VERSION,1); } /* }}} */ diff --git a/ext/standard/mail.c b/ext/standard/mail.c index af6820a869..da06d4007d 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -72,7 +72,6 @@ void php3_mail(INTERNAL_FUNCTION_PARAMETERS) pval *argv[4]; char *to=NULL, *message=NULL, *headers=NULL, *subject=NULL; int argc; - TLS_VARS; argc = ARG_COUNT(ht); if (argc < 3 || argc > 4 || getParametersArray(ht, argc, argv) == FAILURE) { diff --git a/ext/standard/math.c b/ext/standard/math.c index eb427941eb..6641c4f037 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -44,7 +44,6 @@ char *_php3_number_format(double, int, char ,char); Return the absolute value of the number */ void php3_abs(INTERNAL_FUNCTION_PARAMETERS) { pval *value; - TLS_VARS; if (ARG_COUNT(ht)!=1||getParameters(ht,1,&value)==FAILURE) { WRONG_PARAM_COUNT; @@ -69,7 +68,6 @@ void php3_abs(INTERNAL_FUNCTION_PARAMETERS) { Returns the next highest integer value of the number */ void php3_ceil(INTERNAL_FUNCTION_PARAMETERS) { pval *value; - TLS_VARS; if (ARG_COUNT(ht)!=1||getParameters(ht,1,&value)==FAILURE) { WRONG_PARAM_COUNT; @@ -94,7 +92,6 @@ void php3_ceil(INTERNAL_FUNCTION_PARAMETERS) { Returns the next lowest integer value from the number */ void php3_floor(INTERNAL_FUNCTION_PARAMETERS) { pval *value; - TLS_VARS; if (ARG_COUNT(ht)!=1||getParameters(ht,1,&value)==FAILURE) { WRONG_PARAM_COUNT; @@ -134,7 +131,6 @@ inline double rint(double n) void php3_round(INTERNAL_FUNCTION_PARAMETERS) { pval *value; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &value) == FAILURE) { WRONG_PARAM_COUNT; @@ -272,7 +268,6 @@ void php3_pi(INTERNAL_FUNCTION_PARAMETERS) void php3_pow(INTERNAL_FUNCTION_PARAMETERS) { pval *num1, *num2; - TLS_VARS; if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&num1,&num2) == FAILURE) { WRONG_PARAM_COUNT; @@ -348,7 +343,6 @@ void php3_sqrt(INTERNAL_FUNCTION_PARAMETERS) void php3_deg2rad(INTERNAL_FUNCTION_PARAMETERS) { pval *deg; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, °) == FAILURE) { WRONG_PARAM_COUNT; @@ -363,7 +357,6 @@ void php3_deg2rad(INTERNAL_FUNCTION_PARAMETERS) void php3_rad2deg(INTERNAL_FUNCTION_PARAMETERS) { pval *rad; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &rad) == FAILURE) { WRONG_PARAM_COUNT; @@ -452,7 +445,6 @@ void php3_bindec(INTERNAL_FUNCTION_PARAMETERS) { pval *arg; long ret; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) { WRONG_PARAM_COUNT; @@ -471,7 +463,6 @@ void php3_hexdec(INTERNAL_FUNCTION_PARAMETERS) { pval *arg; long ret; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) { WRONG_PARAM_COUNT; @@ -490,7 +481,6 @@ void php3_octdec(INTERNAL_FUNCTION_PARAMETERS) { pval *arg; long ret; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) { WRONG_PARAM_COUNT; diff --git a/ext/standard/md5.c b/ext/standard/md5.c index 959b7dea9a..2aff1c07a4 100644 --- a/ext/standard/md5.c +++ b/ext/standard/md5.c @@ -46,7 +46,6 @@ void php3_md5(INTERNAL_FUNCTION_PARAMETERS) unsigned char digest[16]; int i; char *r; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) { WRONG_PARAM_COUNT; diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c index 81e0694a58..3e1094acda 100644 --- a/ext/standard/microtime.c +++ b/ext/standard/microtime.c @@ -65,7 +65,6 @@ void php3_microtime(INTERNAL_FUNCTION_PARAMETERS) long sec = 0L; double msec = 0.0; char ret[100]; - TLS_VARS; if (gettimeofday((struct timeval *) &tp, (NUL)) == 0) { msec = (double) (tp.tv_usec / MICRO_IN_SEC); diff --git a/ext/standard/mime.c b/ext/standard/mime.c index d6f71e57ac..ec53b7d0d0 100644 --- a/ext/standard/mime.c +++ b/ext/standard/mime.c @@ -222,7 +222,7 @@ void php3_mime_split(char *buf, int cnt, char *boundary, pval *http_post_vars PL } bytes = fwrite(ptr, 1, loc - ptr - 4, fp); fclose(fp); - php3_list_insert(fn,GLOBAL(le_uploads)); /* Tell PHP about the file so the destructor can unlink it later */ + php3_list_insert(fn,le_uploads); /* Tell PHP about the file so the destructor can unlink it later */ if (bytes < (loc - ptr - 4)) { php3_error(E_WARNING, "Only %d bytes were written, expected to write %ld", bytes, loc - ptr - 4); } diff --git a/ext/standard/pack.c b/ext/standard/pack.c index b6dfd1f5eb..3b4eab24cf 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -122,7 +122,6 @@ PHP_FUNCTION(pack) int formatcount = 0; int outputpos = 0, outputsize = 0; char *output; - TLS_VARS; argc = ARG_COUNT(ht); @@ -502,7 +501,6 @@ PHP_FUNCTION(unpack) int formatlen; int inputpos, inputlen; int i; - TLS_VARS; if ((ARG_COUNT(ht) != 2) || getParameters(ht, 2, &formatarg, &inputarg) == FAILURE) { WRONG_PARAM_COUNT; @@ -811,7 +809,6 @@ int php3_minit_pack(INIT_FUNC_ARGS) { int machine_endian_check = 1; int i; - TLS_VARS; machine_little_endian = ((char *)&machine_endian_check)[0]; diff --git a/ext/standard/pageinfo.c b/ext/standard/pageinfo.c index 18ef5df956..e22fce3afd 100644 --- a/ext/standard/pageinfo.c +++ b/ext/standard/pageinfo.c @@ -60,7 +60,6 @@ static void _php3_statpage(void) char *path; struct stat sb; #endif - TLS_VARS; #if APACHE /* Apache has already gone through the trouble of doing @@ -68,20 +67,20 @@ static void _php3_statpage(void) values. We can afford it, and it means we don't have to worry about resetting the static variables after every hit. */ - GLOBAL(page_uid) = GLOBAL(php3_rqst)->finfo.st_uid; - GLOBAL(page_inode) = GLOBAL(php3_rqst)->finfo.st_ino; - GLOBAL(page_mtime) = GLOBAL(php3_rqst)->finfo.st_mtime; + page_uid = php3_rqst->finfo.st_uid; + page_inode = php3_rqst->finfo.st_ino; + page_mtime = php3_rqst->finfo.st_mtime; #else - if (GLOBAL(page_uid) == -1) { - path = GLOBAL(request_info).filename; + if (page_uid == -1) { + path = request_info.filename; if (path != NULL) { if (stat(path, &sb) == -1) { php3_error(E_WARNING, "Unable to find file: '%s'", path); return; } - GLOBAL(page_uid) = sb.st_uid; - GLOBAL(page_inode) = sb.st_ino; - GLOBAL(page_mtime) = sb.st_mtime; + page_uid = sb.st_uid; + page_inode = sb.st_ino; + page_mtime = sb.st_mtime; } } #endif @@ -89,9 +88,8 @@ static void _php3_statpage(void) long _php3_getuid(void) { - TLS_VARS; _php3_statpage(); - return (GLOBAL(page_uid)); + return (page_uid); } /* {{{ proto int getmyuid(void) @@ -99,7 +97,6 @@ long _php3_getuid(void) void php3_getmyuid(INTERNAL_FUNCTION_PARAMETERS) { long uid; - TLS_VARS; uid = _php3_getuid(); if (uid < 0) { @@ -115,7 +112,6 @@ void php3_getmyuid(INTERNAL_FUNCTION_PARAMETERS) void php3_getmypid(INTERNAL_FUNCTION_PARAMETERS) { int pid; - TLS_VARS; pid = getpid(); if (pid < 0) { @@ -130,13 +126,11 @@ void php3_getmypid(INTERNAL_FUNCTION_PARAMETERS) Get the inode of the current script being parsed */ void php3_getmyinode(INTERNAL_FUNCTION_PARAMETERS) { - TLS_VARS; - _php3_statpage(); - if (GLOBAL(page_inode) < 0) { + if (page_inode < 0) { RETURN_FALSE; } else { - RETURN_LONG(GLOBAL(page_inode)); + RETURN_LONG(page_inode); } } /* }}} */ @@ -145,13 +139,11 @@ void php3_getmyinode(INTERNAL_FUNCTION_PARAMETERS) Get time of last page modification */ void php3_getlastmod(INTERNAL_FUNCTION_PARAMETERS) { - TLS_VARS; - _php3_statpage(); - if (GLOBAL(page_mtime) < 0) { + if (page_mtime < 0) { RETURN_FALSE; } else { - RETURN_LONG(GLOBAL(page_mtime)); + RETURN_LONG(page_mtime); } } /* }}} */ diff --git a/ext/standard/post.c b/ext/standard/post.c index 3520c0b3b1..21e09d521a 100644 --- a/ext/standard/post.c +++ b/ext/standard/post.c @@ -54,9 +54,8 @@ static char *php3_getpost(pval *http_post_vars PLS_DC) int file_upload = 0; char *mb; char boundary[100]; - TLS_VARS; - ctype = GLOBAL(request_info).content_type; + ctype = request_info.content_type; if (!ctype) { php3_error(E_WARNING, "POST Error: content-type missing"); return NULL; @@ -81,7 +80,7 @@ static char *php3_getpost(pval *http_post_vars PLS_DC) return NULL; } } - length = GLOBAL(request_info).content_length; + length = request_info.content_length; cnt = length; buf = (char *) emalloc((length + 1) * sizeof(char)); if (!buf) { @@ -93,23 +92,23 @@ static char *php3_getpost(pval *http_post_vars PLS_DC) buf[length]=0; #else #if MODULE_MAGIC_NUMBER > 19961007 - if (should_client_block(GLOBAL(php3_rqst))) { + if (should_client_block(php3_rqst)) { void (*handler) (int); int dbsize, len_read, dbpos = 0; - hard_timeout("copy script args", GLOBAL(php3_rqst)); /* start timeout timer */ + hard_timeout("copy script args", php3_rqst); /* start timeout timer */ handler = signal(SIGPIPE, SIG_IGN); /* Ignore sigpipes for now */ - while ((len_read = get_client_block(GLOBAL(php3_rqst), argsbuffer, HUGE_STRING_LEN)) > 0) { + while ((len_read = get_client_block(php3_rqst, argsbuffer, HUGE_STRING_LEN)) > 0) { if ((dbpos + len_read) > length) dbsize = length - dbpos; else dbsize = len_read; - reset_timeout(GLOBAL(php3_rqst)); /* Make sure we don't timeout */ + reset_timeout(php3_rqst); /* Make sure we don't timeout */ memcpy(buf + dbpos, argsbuffer, dbsize); dbpos += dbsize; } signal(SIGPIPE, handler); /* restore normal sigpipe handling */ - kill_timeout(GLOBAL(php3_rqst)); /* stop timeout timer */ + kill_timeout(php3_rqst); /* stop timeout timer */ } #else cnt = 0; @@ -121,7 +120,7 @@ static char *php3_getpost(pval *http_post_vars PLS_DC) bytes = fread(buf + cnt, 1, length - cnt, stdin); #endif #if USE_SAPI - bytes = GLOBAL(sapi_rqst)->readclient(GLOBAL(sapi_rqst)->scid,buf + cnt, 1, length - cnt); + bytes = sapi_rqst->readclient(sapi_rqst->scid,buf + cnt, 1, length - cnt); #endif cnt += bytes; } while (bytes && cnt < length); @@ -143,7 +142,7 @@ static char *php3_getpost(pval *http_post_vars PLS_DC) postdata_ptr->value.str.len = cnt; postdata_ptr->refcount=1; postdata_ptr->is_ref=0; - _php3_hash_add(&GLOBAL(symbol_table), "HTTP_FDF_DATA", sizeof("HTTP_FDF_DATA"), postdata_ptr, sizeof(pval *),NULL); + _php3_hash_add(&symbol_table, "HTTP_FDF_DATA", sizeof("HTTP_FDF_DATA"), postdata_ptr, sizeof(pval *),NULL); } #endif return (buf); @@ -349,12 +348,12 @@ void php3_treat_data(int arg, char *str) if (arg == PARSE_POST) { res = php3_getpost(array_ptr PLS_CC); } else if (arg == PARSE_GET) { /* Get data */ - var = GLOBAL(request_info).query_string; + var = request_info.query_string; if (var && *var) { res = (char *) estrdup(var); } } else if (arg == PARSE_COOKIE) { /* Cookie data */ - var = (char *)GLOBAL(request_info).cookies; + var = (char *)request_info.cookies; if (var && *var) { res = (char *) estrdup(var); } @@ -408,27 +407,27 @@ void php3_TreatHeaders(void) char *escaped_str; PLS_FETCH(); - if (GLOBAL(php3_rqst)->headers_in) - s = table_get(GLOBAL(php3_rqst)->headers_in, "Authorization"); + if (php3_rqst->headers_in) + s = table_get(php3_rqst->headers_in, "Authorization"); if (!s) return; /* Check to make sure that this URL isn't authenticated using a traditional auth module mechanism */ - if (auth_type(GLOBAL(php3_rqst))) { + if (auth_type(php3_rqst)) { /*php3_error(E_WARNING, "Authentication done by server module\n");*/ return; } - if (strcmp(t=getword(GLOBAL(php3_rqst)->pool, &s, ' '), "Basic")) { + if (strcmp(t=getword(php3_rqst->pool, &s, ' '), "Basic")) { /* Client tried to authenticate using wrong auth scheme */ php3_error(E_WARNING, "client used wrong authentication scheme (%s)", t); return; } - t = uudecode(GLOBAL(php3_rqst)->pool, s); + t = uudecode(php3_rqst->pool, s); #if MODULE_MAGIC_NUMBER > 19961007 - user = getword_nulls_nc(GLOBAL(php3_rqst)->pool, &t, ':'); + user = getword_nulls_nc(php3_rqst->pool, &t, ':'); #else - user = getword(GLOBAL(php3_rqst)->pool, &t, ':'); + user = getword(php3_rqst->pool, &t, ':'); #endif type = "Basic"; diff --git a/ext/standard/reg.c b/ext/standard/reg.c index 4f37bf133a..9b7bbd1899 100644 --- a/ext/standard/reg.c +++ b/ext/standard/reg.c @@ -108,7 +108,6 @@ static void _php3_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase) off_t start, end; char *buf = NULL; char *string = NULL; - TLS_VARS; if (icase) copts |= REG_ICASE; @@ -176,7 +175,7 @@ static void _php3_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase) RETURN_FALSE; } - pval_destructor(array _INLINE_TLS); /* start with clean array */ + pval_destructor(array); /* start with clean array */ array_init(array); for (i = 0; i < NS; i++) { @@ -366,7 +365,6 @@ static void _php3_eregreplace(INTERNAL_FUNCTION_PARAMETERS, int icase) char *string; char *replace; char *ret; - TLS_VARS; if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &arg_pattern, &arg_replace, &arg_string) == FAILURE) { WRONG_PARAM_COUNT; @@ -442,7 +440,6 @@ void php3_split(INTERNAL_FUNCTION_PARAMETERS) regmatch_t subs[1]; char *strp, *endp; int err, size, count; - TLS_VARS; switch (ARG_COUNT(ht)) { case 2: diff --git a/ext/standard/string.c b/ext/standard/string.c index 973081f02f..d87b57cf30 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -49,7 +49,6 @@ void php3_strlen(INTERNAL_FUNCTION_PARAMETERS) { pval *str; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) { WRONG_PARAM_COUNT; @@ -125,7 +124,6 @@ void php3_chop(INTERNAL_FUNCTION_PARAMETERS) { pval *str; register int i; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) { WRONG_PARAM_COUNT; @@ -156,7 +154,6 @@ void php3_trim(INTERNAL_FUNCTION_PARAMETERS) { pval *str; register int i; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) { WRONG_PARAM_COUNT; @@ -198,7 +195,6 @@ void php3_ltrim(INTERNAL_FUNCTION_PARAMETERS) { pval *str; register int i; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) { WRONG_PARAM_COUNT; @@ -268,7 +264,6 @@ void php3_implode(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2, *delim, *tmp, *arr; int len = 0, count = 0; - TLS_VARS; if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { WRONG_PARAM_COUNT; @@ -337,7 +332,6 @@ void php3_strtok(INTERNAL_FUNCTION_PARAMETERS) char *token = NULL, *tokp=NULL; char *first = NULL; int argc; - TLS_VARS; argc = ARG_COUNT(ht); @@ -352,35 +346,35 @@ void php3_strtok(INTERNAL_FUNCTION_PARAMETERS) if (argc == 2) { convert_to_string(str); - STR_FREE(GLOBAL(strtok_string)); - GLOBAL(strtok_string) = estrndup(str->value.str.val,str->value.str.len); - STATIC(strtok_pos1) = GLOBAL(strtok_string); - STATIC(strtok_pos2) = NULL; + STR_FREE(strtok_string); + strtok_string = estrndup(str->value.str.val,str->value.str.len); + strtok_pos1 = strtok_string; + strtok_pos2 = NULL; } - if (STATIC(strtok_pos1) && *STATIC(strtok_pos1)) { + if (strtok_pos1 && *strtok_pos1) { for ( /* NOP */ ; token && *token; token++) { - STATIC(strtok_pos2) = strchr(STATIC(strtok_pos1), (int) *token); - if (!first || (STATIC(strtok_pos2) && STATIC(strtok_pos2) < first)) { - first = STATIC(strtok_pos2); + strtok_pos2 = strchr(strtok_pos1, (int) *token); + if (!first || (strtok_pos2 && strtok_pos2 < first)) { + first = strtok_pos2; } } /* NB: token is unusable now */ - STATIC(strtok_pos2) = first; - if (STATIC(strtok_pos2)) { - *STATIC(strtok_pos2) = '\0'; + strtok_pos2 = first; + if (strtok_pos2) { + *strtok_pos2 = '\0'; } - RETVAL_STRING(STATIC(strtok_pos1),1); + RETVAL_STRING(strtok_pos1,1); #if 0 /* skip 'token' white space for next call to strtok */ - while (STATIC(strtok_pos2) && - strchr(tokp, *(STATIC(strtok_pos2)+1))) { - STATIC(strtok_pos2)++; + while (strtok_pos2 && + strchr(tokp, *(strtok_pos2+1))) { + strtok_pos2++; } #endif - if (STATIC(strtok_pos2)) - STATIC(strtok_pos1) = STATIC(strtok_pos2) + 1; + if (strtok_pos2) + strtok_pos1 = strtok_pos2 + 1; else - STATIC(strtok_pos1) = NULL; + strtok_pos1 = NULL; } else { RETVAL_FALSE; } @@ -406,7 +400,6 @@ void php3_strtoupper(INTERNAL_FUNCTION_PARAMETERS) { pval *arg; char *ret; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg)) { WRONG_PARAM_COUNT; @@ -438,7 +431,6 @@ void php3_strtolower(INTERNAL_FUNCTION_PARAMETERS) { pval *str; char *ret; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str)) { WRONG_PARAM_COUNT; @@ -456,7 +448,6 @@ void php3_basename(INTERNAL_FUNCTION_PARAMETERS) { pval *str; char *ret, *c; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str)) { WRONG_PARAM_COUNT; @@ -509,7 +500,6 @@ void php3_dirname(INTERNAL_FUNCTION_PARAMETERS) { pval *str; char *ret; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str)) { WRONG_PARAM_COUNT; @@ -544,7 +534,6 @@ void php3_stristr(INTERNAL_FUNCTION_PARAMETERS) { pval *haystack, *needle; char *found = NULL; - TLS_VARS; if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &haystack, &needle) == FAILURE) { @@ -573,7 +562,6 @@ void php3_strstr(INTERNAL_FUNCTION_PARAMETERS) { pval *haystack, *needle; char *found = NULL; - TLS_VARS; if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &haystack, &needle) == FAILURE) { @@ -608,7 +596,6 @@ void php3_strpos(INTERNAL_FUNCTION_PARAMETERS) pval *haystack, *needle, *OFFSET; int offset = 0; char *found = NULL; - TLS_VARS; switch(ARG_COUNT(ht)) { case 2: @@ -657,7 +644,6 @@ void php3_strrpos(INTERNAL_FUNCTION_PARAMETERS) { pval *haystack, *needle; char *found = NULL; - TLS_VARS; if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &haystack, &needle) == FAILURE) { WRONG_PARAM_COUNT; @@ -685,7 +671,6 @@ void php3_strrchr(INTERNAL_FUNCTION_PARAMETERS) { pval *haystack, *needle; char *found = NULL; - TLS_VARS; if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &haystack, &needle) == FAILURE) { @@ -753,7 +738,6 @@ void php3_chunk_split(INTERNAL_FUNCTION_PARAMETERS) char *end = "\r\n"; int endlen = 2; int chunklen = 76; - TLS_VARS; argc = ARG_COUNT(ht); @@ -799,7 +783,6 @@ void php3_substr(INTERNAL_FUNCTION_PARAMETERS) pval *string, *from, *len; int argc, l; int f; - TLS_VARS; argc = ARG_COUNT(ht); @@ -858,7 +841,6 @@ void php3_quotemeta(INTERNAL_FUNCTION_PARAMETERS) char *str, *old; char *p, *q; char c; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) { WRONG_PARAM_COUNT; @@ -902,7 +884,6 @@ void php3_quotemeta(INTERNAL_FUNCTION_PARAMETERS) void php3_ord(INTERNAL_FUNCTION_PARAMETERS) { pval *str; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) { WRONG_PARAM_COUNT; @@ -918,7 +899,6 @@ void php3_chr(INTERNAL_FUNCTION_PARAMETERS) { pval *num; char temp[2]; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &num) == FAILURE) { WRONG_PARAM_COUNT; @@ -984,7 +964,6 @@ void php3_strtr(INTERNAL_FUNCTION_PARAMETERS) unsigned char xlat[256]; unsigned char *str_from, *str_to, *string; int i, len1, len2; - TLS_VARS; if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &str, &from, &to) == FAILURE) { @@ -1117,7 +1096,6 @@ void php3_addslashes(INTERNAL_FUNCTION_PARAMETERS) void php3_stripslashes(INTERNAL_FUNCTION_PARAMETERS) { pval *str; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) { WRONG_PARAM_COUNT; @@ -1141,8 +1119,8 @@ char *strerror(int errnum) #endif if ((unsigned int)errnum < sys_nerr) return(sys_errlist[errnum]); - (void)sprintf(STATIC(str_ebuf), "Unknown error: %d", errnum); - return(STATIC(str_ebuf)); + (void)sprintf(str_ebuf, "Unknown error: %d", errnum); + return(str_ebuf); } #endif #endif diff --git a/ext/standard/uniqid.c b/ext/standard/uniqid.c index 548838fdf9..e34d813138 100644 --- a/ext/standard/uniqid.c +++ b/ext/standard/uniqid.c @@ -54,11 +54,9 @@ void php3_uniqid(INTERNAL_FUNCTION_PARAMETERS) { #ifdef HAVE_GETTIMEOFDAY pval *prefix; - char uniqid[128]; int sec, usec; struct timeval tv; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&prefix)==FAILURE) { WRONG_PARAM_COUNT; diff --git a/ext/standard/url.c b/ext/standard/url.c index 4cd32961ea..a44f01a4dc 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -161,7 +161,6 @@ void php3_parse_url(INTERNAL_FUNCTION_PARAMETERS) { pval *string; url *resource; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &string) == FAILURE) { WRONG_PARAM_COUNT; @@ -270,7 +269,6 @@ void php3_urlencode(INTERNAL_FUNCTION_PARAMETERS) { pval *arg; char *str; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) { WRONG_PARAM_COUNT; @@ -292,7 +290,6 @@ void php3_urldecode(INTERNAL_FUNCTION_PARAMETERS) { pval *arg; int len; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) { WRONG_PARAM_COUNT; @@ -367,7 +364,6 @@ void php3_rawurlencode(INTERNAL_FUNCTION_PARAMETERS) { pval *arg; char *str; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) { WRONG_PARAM_COUNT; @@ -389,7 +385,6 @@ void php3_rawurldecode(INTERNAL_FUNCTION_PARAMETERS) { pval *arg; int len; - TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) { WRONG_PARAM_COUNT; |