diff options
Diffstat (limited to 'ext/standard')
34 files changed, 151 insertions, 318 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c index 199075b70e..318f4e08ba 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -98,7 +98,7 @@ PHP_MSHUTDOWN_FUNCTION(array) static void set_compare_func(int sort_type) { - ARRAYLS_FETCH(); + TSRMLS_FETCH(); switch (sort_type) { case SORT_NUMERIC: @@ -123,7 +123,7 @@ static int array_key_compare(const void *a, const void *b) pval result; pval first; pval second; - ARRAYLS_FETCH(); + TSRMLS_FETCH(); f = *((Bucket **) a); s = *((Bucket **) b); @@ -270,7 +270,7 @@ static int array_data_compare(const void *a, const void *b) pval result; pval *first; pval *second; - ARRAYLS_FETCH(); + TSRMLS_FETCH(); f = *((Bucket **) a); s = *((Bucket **) b); @@ -523,7 +523,6 @@ static int array_user_compare(const void *a, const void *b) pval **args[2]; pval *retval_ptr; TSRMLS_FETCH(); - BLS_FETCH(); f = *((Bucket **) a); s = *((Bucket **) b); @@ -551,7 +550,6 @@ PHP_FUNCTION(usort) pval **array; pval **old_compare_func; HashTable *target_hash; - BLS_FETCH(); old_compare_func = BG(user_compare_func_name); if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &array, &BG(user_compare_func_name)) == FAILURE) { @@ -580,7 +578,6 @@ PHP_FUNCTION(uasort) pval **array; pval **old_compare_func; HashTable *target_hash; - BLS_FETCH(); old_compare_func = BG(user_compare_func_name); if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &array, &BG(user_compare_func_name)) == FAILURE) { @@ -611,7 +608,6 @@ static int array_user_key_compare(const void *a, const void *b) pval retval; int status; TSRMLS_FETCH(); - BLS_FETCH(); args[0] = &key1; args[1] = &key2; @@ -658,7 +654,6 @@ PHP_FUNCTION(uksort) pval **array; pval **old_compare_func; HashTable *target_hash; - BLS_FETCH(); old_compare_func = BG(user_compare_func_name); if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &array, &BG(user_compare_func_name)) == FAILURE) { @@ -958,7 +953,6 @@ static int php_array_walk(HashTable *target_hash, zval **userdata) ulong string_key_len; ulong num_key; HashPosition pos; - BLS_FETCH(); TSRMLS_FETCH(); /* Allocate space for key */ @@ -1000,13 +994,13 @@ static int php_array_walk(HashTable *target_hash, zval **userdata) /* {{{ proto int array_walk(array input, string funcname [, mixed userdata]) Apply a user function to every member of an array */ -PHP_FUNCTION(array_walk) { +PHP_FUNCTION(array_walk) +{ int argc; zval **array, **userdata = NULL, **old_walk_func_name; HashTable *target_hash; - BLS_FETCH(); argc = ZEND_NUM_ARGS(); old_walk_func_name = BG(array_walk_func_name); @@ -2513,7 +2507,7 @@ int multisort_compare(const void *a, const void *b) int r; int result = 0; zval temp; - ARRAYLS_FETCH(); + TSRMLS_FETCH(); r = 0; do { @@ -2552,7 +2546,6 @@ PHP_FUNCTION(array_multisort) int sort_order = SORT_ASC; int sort_type = SORT_REGULAR; int i, k; - ARRAYLS_FETCH(); /* Get the argument count and check it */ argc = ZEND_NUM_ARGS(); diff --git a/ext/standard/assert.c b/ext/standard/assert.c index 1fc1684011..e7c2b3fd61 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -33,20 +33,10 @@ typedef struct { } php_assert_globals; #ifdef ZTS -#define ASSERTLS_D php_assert_globals *assert_globals -#define ASSERTLS_DC , ASSERTLS_D -#define ASSERTLS_C assert_globals -#define ASSERTLS_CC , ASSERTLS_CC -#define ASSERT(v) (assert_globals->v) -#define ASSERTLS_FETCH() php_assert_globals *assert_globals = ts_resource(assert_globals_id) +#define ASSERTG(v) TSRMG(assert_globals_id, php_assert_globals *, v) int assert_globals_id; #else -#define ASSERTLS_D -#define ASSERTLS_DC -#define ASSERTLS_C -#define ASSERTLS_CC -#define ASSERT(v) (assert_globals.v) -#define ASSERTLS_FETCH() +#define ASSERTG(v) (assert_globals.v) php_assert_globals assert_globals; #endif @@ -62,18 +52,18 @@ enum { static PHP_INI_MH(OnChangeCallback) { - ASSERTLS_FETCH(); + TSRMLS_FETCH(); - if (ASSERT(callback)) { - zval_ptr_dtor(&ASSERT(callback)); + if (ASSERTG(callback)) { + zval_ptr_dtor(&ASSERTG(callback)); } else { - MAKE_STD_ZVAL(ASSERT(callback)); + MAKE_STD_ZVAL(ASSERTG(callback)); } if (new_value) - ZVAL_STRINGL(ASSERT(callback),new_value,new_value_length,1) + ZVAL_STRINGL(ASSERTG(callback),new_value,new_value_length,1) else - ZVAL_EMPTY_STRING(ASSERT(callback)) + ZVAL_EMPTY_STRING(ASSERTG(callback)) return SUCCESS; } @@ -86,9 +76,9 @@ PHP_INI_BEGIN() STD_PHP_INI_ENTRY("assert.quiet_eval", "0", PHP_INI_ALL, OnUpdateInt, quiet_eval, php_assert_globals, assert_globals) PHP_INI_END() -static void php_assert_init_globals(ASSERTLS_D TSRMLS_DC) +static void php_assert_init_globals(php_assert_globals *assert_globals_p TSRMLS_DC) { - ASSERT(callback) = NULL; + ASSERTG(callback) = NULL; } PHP_MINIT_FUNCTION(assert) @@ -97,7 +87,7 @@ PHP_MINIT_FUNCTION(assert) #ifdef ZTS ts_allocate_id(&assert_globals_id, sizeof(php_assert_globals), (ts_allocate_ctor) php_assert_init_globals, NULL); #else - php_assert_init_globals(ASSERTLS_C TSRMLS_CC); + php_assert_init_globals(&assert_globals TSRMLS_CC); #endif REGISTER_INI_ENTRIES(); @@ -113,21 +103,21 @@ PHP_MINIT_FUNCTION(assert) PHP_MSHUTDOWN_FUNCTION(assert) { - ASSERTLS_FETCH(); + TSRMLS_FETCH(); - if (ASSERT(callback)) { - zval_ptr_dtor(&ASSERT(callback)); + if (ASSERTG(callback)) { + zval_ptr_dtor(&ASSERTG(callback)); } return SUCCESS; } PHP_RSHUTDOWN_FUNCTION(assert) { - ASSERTLS_FETCH(); + TSRMLS_FETCH(); - if (ASSERT(callback)) { - zval_ptr_dtor(&ASSERT(callback)); - ASSERT(callback) = NULL; + if (ASSERTG(callback)) { + zval_ptr_dtor(&ASSERTG(callback)); + ASSERTG(callback) = NULL; } return SUCCESS; @@ -150,10 +140,8 @@ PHP_FUNCTION(assert) int val; char *myeval = NULL; char *compiled_string_description; - CLS_FETCH(); - ASSERTLS_FETCH(); - if (! ASSERT(active)) { + if (! ASSERTG(active)) { RETURN_TRUE; } @@ -167,20 +155,20 @@ PHP_FUNCTION(assert) myeval = Z_STRVAL_PP(assertion); - if (ASSERT(quiet_eval)) { + if (ASSERTG(quiet_eval)) { old_error_reporting = EG(error_reporting); EG(error_reporting) = 0; } compiled_string_description = zend_make_compiled_string_description("assert code"); - if (zend_eval_string(myeval, &retval, compiled_string_description CLS_CC TSRMLS_CC) == FAILURE) { + if (zend_eval_string(myeval, &retval, compiled_string_description TSRMLS_CC) == FAILURE) { efree(compiled_string_description); zend_error(E_ERROR, "Failure evaluating code:\n%s\n", myeval); /* zend_error() does not return in this case. */ } efree(compiled_string_description); - if (ASSERT(quiet_eval)) { + if (ASSERTG(quiet_eval)) { EG(error_reporting) = old_error_reporting; } @@ -195,7 +183,7 @@ PHP_FUNCTION(assert) RETURN_TRUE; } - if (ASSERT(callback)) { + if (ASSERTG(callback)) { zval *args[4]; zval *retval; int i; @@ -214,7 +202,7 @@ PHP_FUNCTION(assert) ZVAL_FALSE(retval); /* XXX do we want to check for error here? */ - call_user_function(CG(function_table), NULL, ASSERT(callback), retval, 3, args); + call_user_function(CG(function_table), NULL, ASSERTG(callback), retval, 3, args); for (i = 0; i <= 2; i++) { zval_ptr_dtor(&(args[i])); @@ -222,7 +210,7 @@ PHP_FUNCTION(assert) zval_ptr_dtor(&retval); } - if (ASSERT(warning)) { + if (ASSERTG(warning)) { if (myeval) { php_error(E_WARNING,"Assertion \"%s\" failed",myeval); } else { @@ -230,7 +218,7 @@ PHP_FUNCTION(assert) } } - if (ASSERT(bail)) { + if (ASSERTG(bail)) { zend_bailout(); } } @@ -244,7 +232,6 @@ PHP_FUNCTION(assert_options) pval **what,**value; int oldint; int ac = ZEND_NUM_ARGS(); - ASSERTLS_FETCH(); if (ac < 1 || ac > 2 || zend_get_parameters_ex(ac, &what, &value) == FAILURE) { WRONG_PARAM_COUNT; @@ -254,47 +241,47 @@ PHP_FUNCTION(assert_options) switch ((*what)->value.lval) { case ASSERT_ACTIVE: - oldint = ASSERT(active); + oldint = ASSERTG(active); if (ac == 2) { convert_to_long_ex(value); - ASSERT(active) = Z_LVAL_PP(value); + ASSERTG(active) = Z_LVAL_PP(value); } RETURN_LONG(oldint); break; case ASSERT_BAIL: - oldint = ASSERT(bail); + oldint = ASSERTG(bail); if (ac == 2) { convert_to_long_ex(value); - ASSERT(bail) = Z_LVAL_PP(value); + ASSERTG(bail) = Z_LVAL_PP(value); } RETURN_LONG(oldint); break; case ASSERT_QUIET_EVAL: - oldint = ASSERT(quiet_eval); + oldint = ASSERTG(quiet_eval); if (ac == 2) { convert_to_long_ex(value); - ASSERT(quiet_eval) = Z_LVAL_PP(value); + ASSERTG(quiet_eval) = Z_LVAL_PP(value); } RETURN_LONG(oldint); break; case ASSERT_WARNING: - oldint = ASSERT(warning); + oldint = ASSERTG(warning); if (ac == 2) { convert_to_long_ex(value); - ASSERT(warning) = Z_LVAL_PP(value); + ASSERTG(warning) = Z_LVAL_PP(value); } RETURN_LONG(oldint); break; case ASSERT_CALLBACK: if (ac == 2) { - if (ASSERT(callback)) { - zval_ptr_dtor(&ASSERT(callback)); + if (ASSERTG(callback)) { + zval_ptr_dtor(&ASSERTG(callback)); } - ASSERT(callback) = *value; + ASSERTG(callback) = *value; zval_add_ref(value); } RETURN_TRUE; diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index da7588ecdb..60c7b61ee7 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -619,7 +619,7 @@ static PHP_INI_MH(OnUpdateSafeModeProtectedEnvVars) char *protected_vars, *protected_var; char *token_buf; int dummy=1; - BLS_FETCH(); + TSRMLS_FETCH(); protected_vars = estrndup(new_value, new_value_length); zend_hash_clean(&BG(sm_protected_env_vars)); @@ -636,7 +636,7 @@ static PHP_INI_MH(OnUpdateSafeModeProtectedEnvVars) static PHP_INI_MH(OnUpdateSafeModeAllowedEnvVars) { - BLS_FETCH(); + TSRMLS_FETCH(); if (BG(sm_allowed_env_vars)) { free(BG(sm_allowed_env_vars)); @@ -691,7 +691,7 @@ static void php_putenv_destructor(putenv_entry *pe) void test_class_startup(void); -static void basic_globals_ctor(BLS_D TSRMLS_DC) +static void basic_globals_ctor(php_basic_globals *basic_globals_p TSRMLS_DC) { BG(next) = NULL; BG(left) = -1; @@ -709,7 +709,7 @@ static void basic_globals_ctor(BLS_D TSRMLS_DC) #endif } -static void basic_globals_dtor(BLS_D TSRMLS_DC) +static void basic_globals_dtor(php_basic_globals *basic_globals_p TSRMLS_DC) { zend_hash_destroy(&BG(sm_protected_env_vars)); if (BG(sm_allowed_env_vars)) { @@ -723,12 +723,10 @@ static void basic_globals_dtor(BLS_D TSRMLS_DC) PHP_MINIT_FUNCTION(basic) { - PLS_FETCH(); - #ifdef ZTS ts_allocate_id(&basic_globals_id, sizeof(php_basic_globals), (ts_allocate_ctor) basic_globals_ctor, (ts_allocate_dtor) basic_globals_dtor); #else - basic_globals_ctor(BLS_C TSRMLS_CC); + basic_globals_ctor(&basic_globals TSRMLS_CC); #endif REGISTER_LONG_CONSTANT("CONNECTION_ABORTED", PHP_CONNECTION_ABORTED, CONST_CS | CONST_PERSISTENT); @@ -802,14 +800,13 @@ PHP_MINIT_FUNCTION(basic) PHP_MSHUTDOWN_FUNCTION(basic) { - PLS_FETCH(); - BLS_FETCH(); TSRMLS_FETCH(); - basic_globals_dtor(BLS_C TSRMLS_CC); #ifdef ZTS ts_free_id(basic_globals_id); +#else + basic_globals_dtor(&basic_globals TSRMLS_CC); #endif if(PG(allow_url_fopen)) { @@ -838,8 +835,6 @@ PHP_MSHUTDOWN_FUNCTION(basic) PHP_RINIT_FUNCTION(basic) { - BLS_FETCH(); - BG(strtok_string) = NULL; BG(locale_string) = NULL; BG(user_compare_func_name) = NULL; @@ -884,7 +879,7 @@ PHP_RINIT_FUNCTION(basic) PHP_RSHUTDOWN_FUNCTION(basic) { - BLS_FETCH(); + TSRMLS_FETCH(); STR_FREE(BG(strtok_string)); BG(strtok_string) = NULL; @@ -1030,7 +1025,6 @@ PHP_FUNCTION(getenv) PHP_FUNCTION(putenv) { pval **str; - BLS_FETCH(); if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) { WRONG_PARAM_COUNT; @@ -1041,7 +1035,6 @@ PHP_FUNCTION(putenv) int ret; char *p,**env; putenv_entry pe; - PLS_FETCH(); pe.putenv_string = estrndup(Z_STRVAL_PP(str),Z_STRLEN_PP(str)); pe.key = estrndup(Z_STRVAL_PP(str), Z_STRLEN_PP(str)); @@ -1333,7 +1326,6 @@ PHP_FUNCTION(get_cfg_var) PHP_FUNCTION(set_magic_quotes_runtime) { pval **new_setting; - PLS_FETCH(); if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &new_setting)==FAILURE) { RETURN_FALSE; @@ -1349,8 +1341,6 @@ PHP_FUNCTION(set_magic_quotes_runtime) Get the current active configuration setting of magic_quotes_runtime */ PHP_FUNCTION(get_magic_quotes_runtime) { - PLS_FETCH(); - RETURN_LONG(PG(magic_quotes_runtime)); } /* }}} */ @@ -1359,8 +1349,6 @@ PHP_FUNCTION(get_magic_quotes_runtime) Get the current active configuration setting of magic_quotes_gpc */ PHP_FUNCTION(get_magic_quotes_gpc) { - PLS_FETCH(); - RETURN_LONG(PG(magic_quotes_gpc)); } /* }}} */ @@ -1865,7 +1853,7 @@ static void user_tick_function_call(user_tick_function_entry *tick_fe) static void run_user_tick_functions(int tick_count) { - BLS_FETCH(); + TSRMLS_FETCH(); zend_llist_apply(BG(user_tick_functions), (llist_apply_func_t)user_tick_function_call); } @@ -1888,7 +1876,6 @@ static int user_tick_function_compare(user_tick_function_entry *tick_fe1, void php_call_shutdown_functions(void) { - BLS_FETCH(); TSRMLS_FETCH(); if (BG(user_shutdown_function_names)) zend_try { @@ -1905,7 +1892,6 @@ PHP_FUNCTION(register_shutdown_function) { php_shutdown_function_entry shutdown_function_entry; int i; - BLS_FETCH(); shutdown_function_entry.arg_count = ZEND_NUM_ARGS(); @@ -2203,8 +2189,6 @@ PHP_FUNCTION(print_r) Returns true if client disconnected */ PHP_FUNCTION(connection_aborted) { - PLS_FETCH(); - RETURN_LONG(PG(connection_status)&PHP_CONNECTION_ABORTED); } /* }}} */ @@ -2213,8 +2197,6 @@ PHP_FUNCTION(connection_aborted) Returns the connection status bitfield */ PHP_FUNCTION(connection_status) { - PLS_FETCH(); - RETURN_LONG(PG(connection_status)); } /* }}} */ @@ -2225,7 +2207,6 @@ PHP_FUNCTION(ignore_user_abort) { pval **arg; int old_setting; - PLS_FETCH(); old_setting = PG(ignore_user_abort); switch (ZEND_NUM_ARGS()) { @@ -2355,7 +2336,6 @@ PHP_FUNCTION(register_tick_function) { user_tick_function_entry tick_fe; int i; - BLS_FETCH(); tick_fe.arg_count = ZEND_NUM_ARGS(); if (tick_fe.arg_count < 1) { @@ -2394,7 +2374,6 @@ PHP_FUNCTION(unregister_tick_function) { zval **function; user_tick_function_entry tick_fe; - BLS_FETCH(); if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &function)) { WRONG_PARAM_COUNT; @@ -2426,7 +2405,6 @@ PHPAPI PHP_FUNCTION(warn_not_available) PHP_FUNCTION(is_uploaded_file) { zval **path; - SLS_FETCH(); if (!SG(rfc1867_uploaded_files)) { RETURN_FALSE; @@ -2452,8 +2430,6 @@ PHP_FUNCTION(move_uploaded_file) { zval **path, **new_path; zend_bool successful=0; - SLS_FETCH(); - PLS_FETCH(); if (!SG(rfc1867_uploaded_files)) { RETURN_FALSE; @@ -2513,7 +2489,7 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, int callback_type, static void php_ini_parser_cb_with_sections(zval *arg1, zval *arg2, int callback_type, zval *arr) { zval *element; - BLS_FETCH(); + TSRMLS_FETCH(); switch (callback_type) { case ZEND_INI_PARSER_ENTRY: { @@ -2561,7 +2537,7 @@ PHP_FUNCTION(parse_ini_file) } convert_to_boolean_ex(process_sections); if (Z_BVAL_PP(process_sections)) { - BLS_FETCH(); + TSRMLS_FETCH(); BG(active_ini_file_section) = NULL; ini_parser_cb = (zend_ini_parser_cb_t) php_ini_parser_cb_with_sections; diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h index f72c8f77b7..8fac9cb70e 100644 --- a/ext/standard/basic_functions.h +++ b/ext/standard/basic_functions.h @@ -194,20 +194,10 @@ typedef struct { } php_basic_globals; #ifdef ZTS -#define BLS_D php_basic_globals *basic_globals -#define BLS_DC , BLS_D -#define BLS_C basic_globals -#define BLS_CC , BLS_C -#define BG(v) (basic_globals->v) -#define BLS_FETCH() php_basic_globals *basic_globals = ts_resource(basic_globals_id) +#define BG(v) TSRMG(basic_globals_id, php_basic_globals *, v) extern int basic_globals_id; #else -#define BLS_D -#define BLS_DC -#define BLS_C -#define BLS_CC #define BG(v) (basic_globals.v) -#define BLS_FETCH() extern php_basic_globals basic_globals; #endif diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c index 91183591b7..a6ae0eaf51 100644 --- a/ext/standard/browscap.c +++ b/ext/standard/browscap.c @@ -206,7 +206,6 @@ PHP_FUNCTION(get_browser) zval **agent_name,**agent; zval *found_browser_entry,*tmp_copy; char *lookup_browser_name; - PLS_FETCH(); if (!INI_STR("browscap")) { RETURN_FALSE; diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c index e94f1a3bc6..e48c20e1f8 100644 --- a/ext/standard/datetime.c +++ b/ext/standard/datetime.c @@ -652,7 +652,7 @@ char *php_std_date(time_t t) { struct tm *tm1, tmbuf; char *str; - PLS_FETCH(); + TSRMLS_FETCH(); tm1 = php_gmtime_r(&t, &tmbuf); str = emalloc(81); diff --git a/ext/standard/dir.c b/ext/standard/dir.c index b64893b8d1..0d5a935498 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -45,20 +45,10 @@ typedef struct { } php_dir_globals; #ifdef ZTS -#define DIRG(v) (dir_globals->v) -#define DIRLS_FETCH() php_dir_globals *dir_globals = ts_resource(dir_globals_id) -#define DIRLS_D php_dir_globals *dir_globals -#define DIRLS_DC , DIRLS_D -#define DIRLS_C dir_globals -#define DIRLS_CC , DIRLS_C +#define DIRG(v) TSRMG(dir_globals_id, php_dir_globals *, v) int dir_globals_id; #else #define DIRG(v) (dir_globals.v) -#define DIRLS_FETCH() -#define DIRLS_D -#define DIRLS_DC -#define DIRLS_C -#define DIRLS_CC php_dir_globals dir_globals; #endif @@ -97,7 +87,7 @@ static zend_function_entry php_dir_class_functions[] = { }; -static void php_set_default_dir(int id DIRLS_DC) +static void php_set_default_dir(int id TSRMLS_DC) { if (DIRG(default_dir)!=-1) { zend_list_delete(DIRG(default_dir)); @@ -120,8 +110,6 @@ static void _dir_dtor(zend_rsrc_list_entry *rsrc) PHP_RINIT_FUNCTION(dir) { - DIRLS_FETCH(); - DIRG(default_dir) = -1; return SUCCESS; } @@ -153,7 +141,6 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject) { pval **arg; php_dir *dirp; - DIRLS_FETCH(); if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) { WRONG_PARAM_COUNT; @@ -183,7 +170,7 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject) dirp->id = zend_list_insert(dirp,le_dirp); - php_set_default_dir(dirp->id DIRLS_CC); + php_set_default_dir(dirp->id TSRMLS_CC); if (createobject) { object_init_ex(return_value, dir_class_entry_ptr); @@ -221,14 +208,13 @@ PHP_FUNCTION(closedir) { pval **id, **tmp, *myself; php_dir *dirp; - DIRLS_FETCH(); FETCH_DIRP(); zend_list_delete(dirp->id); if (dirp->id == DIRG(default_dir)) { - php_set_default_dir(-1 DIRLS_CC); + php_set_default_dir(-1 TSRMLS_CC); } } @@ -275,7 +261,6 @@ PHP_FUNCTION(chdir) { pval **arg; int ret; - PLS_FETCH(); if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) { WRONG_PARAM_COUNT; @@ -334,7 +319,6 @@ PHP_FUNCTION(rewinddir) { pval **id, **tmp, *myself; php_dir *dirp; - DIRLS_FETCH(); FETCH_DIRP(); @@ -350,7 +334,6 @@ PHP_NAMED_FUNCTION(php_if_readdir) php_dir *dirp; char entry[sizeof(struct dirent)+MAXPATHLEN]; struct dirent *result = (struct dirent *)&entry; /* patch for libc5 readdir problems */ - DIRLS_FETCH(); FETCH_DIRP(); diff --git a/ext/standard/dl.c b/ext/standard/dl.c index e911f74a80..498eddc799 100644 --- a/ext/standard/dl.c +++ b/ext/standard/dl.c @@ -56,7 +56,6 @@ PHP_FUNCTION(dl) { pval **file; - PLS_FETCH(); #ifdef ZTS if (strcmp(sapi_module.name, "cgi")!=0) { @@ -101,10 +100,8 @@ void php_dl(pval *file, int type, pval *return_value) zend_module_entry *(*get_module)(void); int error_type; char *extension_dir; - PLS_FETCH(); TSRMLS_FETCH(); - if (type==MODULE_PERSISTENT) { /* Use the configuration hash directly, the INI mechanism is not yet initialized */ if (cfg_get_string("extension_dir", &extension_dir)==FAILURE) { diff --git a/ext/standard/exec.c b/ext/standard/exec.c index 3dd541d212..7d538a4335 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -54,8 +54,7 @@ int php_Exec(int type, char *cmd, pval *array, pval *return_value) #if PHP_SIGCHILD void (*sig_handler)(); #endif - PLS_FETCH(); - FLS_FETCH(); + TSRMLS_FETCH(); buf = (char*) emalloc(EXEC_INPUT_BUF); if (!buf) { @@ -458,7 +457,6 @@ PHP_FUNCTION(shell_exec) int readbytes,total_readbytes=0,allocated_space; pval **cmd; char *ret; - PLS_FETCH(); if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1,&cmd)==FAILURE) { WRONG_PARAM_COUNT; diff --git a/ext/standard/file.c b/ext/standard/file.c index 4fa6eccf92..0af13d8388 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -115,7 +115,7 @@ static int le_stream = FAILURE; static void _file_popen_dtor(zend_rsrc_list_entry *rsrc) { FILE *pipe = (FILE *)rsrc->ptr; - FLS_FETCH(); + TSRMLS_FETCH(); FG(pclose_ret) = pclose(pipe); } @@ -168,7 +168,7 @@ PHPAPI int php_file_le_socket(void) /* XXX doe we really want this???? */ } -static void file_globals_ctor(FLS_D TSRMLS_DC) +static void file_globals_ctor(php_file_globals *file_globals_p TSRMLS_DC) { zend_hash_init(&FG(ht_fsock_keys), 0, NULL, NULL, 1); zend_hash_init(&FG(ht_fsock_socks), 0, NULL, (void (*)(void *))php_msock_destroy, 1); @@ -179,11 +179,11 @@ static void file_globals_ctor(FLS_D TSRMLS_DC) } -static void file_globals_dtor(FLS_D TSRMLS_DC) +static void file_globals_dtor(php_file_globals *file_globals_p TSRMLS_DC) { zend_hash_destroy(&FG(ht_fsock_socks)); zend_hash_destroy(&FG(ht_fsock_keys)); - php_cleanup_sockbuf(1 FLS_CC); + php_cleanup_sockbuf(1 TSRMLS_CC); } @@ -200,7 +200,7 @@ PHP_MINIT_FUNCTION(file) #ifdef ZTS ts_allocate_id(&file_globals_id, sizeof(php_file_globals), (ts_allocate_ctor) file_globals_ctor, (ts_allocate_dtor) file_globals_dtor); #else - file_globals_ctor(FLS_C TSRMLS_CC); + file_globals_ctor(&file_globals TSRMLS_CC); #endif REGISTER_LONG_CONSTANT("SEEK_SET", SEEK_SET, CONST_CS | CONST_PERSISTENT); @@ -219,10 +219,9 @@ PHP_MINIT_FUNCTION(file) PHP_MSHUTDOWN_FUNCTION(file) { #ifndef ZTS - FLS_FETCH(); TSRMLS_FETCH(); - file_globals_dtor(FLS_C TSRMLS_CC); + file_globals_dtor(&file_globals TSRMLS_CC); #endif return SUCCESS; } @@ -298,7 +297,6 @@ PHP_FUNCTION(get_meta_tags) char *name=NULL, *value=NULL, *temp=NULL; php_meta_tags_token tok, tok_last; php_meta_tags_data md; - PLS_FETCH(); /* check args */ switch (ARG_COUNT(ht)) { @@ -479,7 +477,6 @@ PHP_FUNCTION(file) int issock=0, socketd=0; int target_len, len; zend_bool reached_eof=0; - PLS_FETCH(); /* check args */ switch (ARG_COUNT(ht)) { @@ -645,7 +642,6 @@ PHP_NAMED_FUNCTION(php_if_fopen) int *sock; int use_include_path = 0; int issock=0, socketd=0; - FLS_FETCH(); switch(ARG_COUNT(ht)) { case 2: @@ -726,7 +722,6 @@ PHP_FUNCTION(popen) FILE *fp; char *p,*tmp = NULL; char *b, buf[1024]; - PLS_FETCH(); if (ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { WRONG_PARAM_COUNT; @@ -783,7 +778,6 @@ PHP_FUNCTION(pclose) { pval **arg1; void *what; - FLS_FETCH(); if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { WRONG_PARAM_COUNT; @@ -995,7 +989,6 @@ PHP_FUNCTION(fgets) int issock=0; int socketd=0; void *what; - PLS_FETCH(); if (ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { WRONG_PARAM_COUNT; @@ -1128,7 +1121,6 @@ PHP_FUNCTION(fgetss) void *what; char *allowed_tags=NULL; int allowed_tags_len=0; - FLS_FETCH(); switch(ARG_COUNT(ht)) { case 2: @@ -1279,7 +1271,6 @@ PHP_FUNCTION(fwrite) int issock=0; int socketd=0; void *what; - PLS_FETCH(); switch (ARG_COUNT(ht)) { case 2: @@ -1508,7 +1499,6 @@ PHP_FUNCTION(mkdir) pval **arg1, **arg2; int ret; mode_t mode; - PLS_FETCH(); if (ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { WRONG_PARAM_COUNT; @@ -1535,7 +1525,6 @@ PHP_FUNCTION(rmdir) { pval **arg1; int ret; - PLS_FETCH(); if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { WRONG_PARAM_COUNT; @@ -1578,7 +1567,8 @@ static size_t php_passthru_fd(int socketd, FILE *fp, int issock) len = sbuf.st_size - off; p = mmap(0, len, PROT_READ, MAP_SHARED, fd, off); if (p != (void *) MAP_FAILED) { - BLS_FETCH(); + TSRMLS_FETCH(); + BG(mmap_file) = p; BG(mmap_len) = len; PHPWRITE(p, len); @@ -1732,7 +1722,6 @@ PHP_FUNCTION(rename) pval **old_arg, **new_arg; char *old_name, *new_name; int ret; - PLS_FETCH(); if (ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &old_arg, &new_arg) == FAILURE) { WRONG_PARAM_COUNT; @@ -1764,7 +1753,6 @@ PHP_FUNCTION(unlink) { pval **filename; int ret; - PLS_FETCH(); if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) { WRONG_PARAM_COUNT; @@ -1907,7 +1895,6 @@ PHP_NAMED_FUNCTION(php_if_fstat) PHP_FUNCTION(copy) { pval **source, **target; - PLS_FETCH(); if (ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &source, &target) == FAILURE) { WRONG_PARAM_COUNT; @@ -2010,7 +1997,6 @@ PHP_FUNCTION(fread) int issock=0; int socketd=0; void *what; - PLS_FETCH(); if (ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { WRONG_PARAM_COUNT; diff --git a/ext/standard/file.h b/ext/standard/file.h index 3f4ad17066..298c3dc8fb 100644 --- a/ext/standard/file.h +++ b/ext/standard/file.h @@ -114,20 +114,10 @@ typedef struct { } php_file_globals; #ifdef ZTS -#define FLS_D php_file_globals *file_globals -#define FLS_DC , FLS_D -#define FLS_C file_globals -#define FLS_CC , FLS_C -#define FG(v) (file_globals->v) -#define FLS_FETCH() php_file_globals *file_globals = ts_resource(file_globals_id) +#define FG(v) TSRMG(file_globals_id, php_file_globals *, v) extern int file_globals_id; #else -#define FLS_D void -#define FLS_DC -#define FLS_C -#define FLS_CC #define FG(v) (file_globals.v) -#define FLS_FETCH() extern php_file_globals file_globals; #endif diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index 3141d871f0..227846328b 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -88,8 +88,6 @@ PHP_RINIT_FUNCTION(filestat) { - BLS_FETCH(); - BG(CurrentStatFile)=NULL; BG(CurrentStatLength)=0; return SUCCESS; @@ -98,7 +96,7 @@ PHP_RINIT_FUNCTION(filestat) PHP_RSHUTDOWN_FUNCTION(filestat) { - BLS_FETCH(); + TSRMLS_FETCH(); if (BG(CurrentStatFile)) { efree (BG(CurrentStatFile)); @@ -316,7 +314,6 @@ PHP_FUNCTION(chgrp) gid_t gid; struct group *gr=NULL; int ret; - PLS_FETCH(); if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2,&filename,&group)==FAILURE) { WRONG_PARAM_COUNT; @@ -364,7 +361,6 @@ PHP_FUNCTION(chown) int ret; uid_t uid; struct passwd *pw = NULL; - PLS_FETCH(); if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2,&filename,&user)==FAILURE) { WRONG_PARAM_COUNT; @@ -408,7 +404,6 @@ PHP_FUNCTION(chmod) pval **filename, **mode; int ret; mode_t imode; - PLS_FETCH(); if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2,&filename,&mode)==FAILURE) { WRONG_PARAM_COUNT; @@ -452,7 +447,6 @@ PHP_FUNCTION(touch) FILE *file; struct utimbuf *newtime = NULL; int ac = ZEND_NUM_ARGS(); - PLS_FETCH(); if (ac == 1 && zend_get_parameters_ex(1,&filename) != FAILURE) { #ifndef HAVE_UTIME_NULL @@ -517,8 +511,6 @@ PHP_FUNCTION(touch) Clear file stat cache */ PHP_FUNCTION(clearstatcache) { - BLS_FETCH(); - if (BG(CurrentStatFile)) { efree(BG(CurrentStatFile)); BG(CurrentStatFile) = NULL; @@ -538,7 +530,7 @@ static void php_stat(const char *filename, php_stat_len filename_length, int typ int rmask=S_IROTH,wmask=S_IWOTH,xmask=S_IXOTH; /* access rights defaults to other */ char *stat_sb_names[13]={"dev","ino","mode","nlink","uid","gid","rdev", "size","atime","mtime","ctime","blksize","blocks"}; - BLS_FETCH(); + TSRMLS_FETCH(); stat_sb = &BG(sb); diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c index 0cf92a2ad6..d42e984de1 100644 --- a/ext/standard/fsock.c +++ b/ext/standard/fsock.c @@ -126,7 +126,7 @@ PHPAPI int php_lookup_hostname(const char *addr, struct in_addr *in) PHPAPI int php_is_persistent_sock(int sock) { char *key; - FLS_FETCH(); + TSRMLS_FETCH(); if (zend_hash_find(&FG(ht_fsock_socks), (char *) &sock, sizeof(sock), (void **) &key) == SUCCESS) { @@ -153,7 +153,6 @@ static void php_fsockopen(INTERNAL_FUNCTION_PARAMETERS, int persistent) { unsigned short portno; unsigned long conv; char *key = NULL; - FLS_FETCH(); if (arg_count > 5 || arg_count < 2 || zend_get_parameters_array_ex(arg_count,args)==FAILURE) { CLOSE_SOCK(1); @@ -304,7 +303,7 @@ PHP_FUNCTION(pfsockopen) FG(phpsockbuf) = sock->next; \ pefree(sock, sock->persistent) -PHPAPI void php_cleanup_sockbuf(int persistent FLS_DC) +PHPAPI void php_cleanup_sockbuf(int persistent TSRMLS_DC) { php_sockbuf *now, *next; @@ -321,11 +320,11 @@ PHPAPI void php_cleanup_sockbuf(int persistent FLS_DC) #define WRITEPTR(sock) ((sock)->readbuf + (sock)->writepos) #define SOCK_FIND(sock,socket) \ php_sockbuf *sock; \ - FLS_FETCH(); \ - sock = php_sockfind(socket FLS_CC); \ - if(!sock) sock = php_sockcreate(socket FLS_CC) + TSRMLS_FETCH(); \ + sock = php_sockfind(socket TSRMLS_CC); \ + if(!sock) sock = php_sockcreate(socket TSRMLS_CC) -static php_sockbuf *php_sockfind(int socket FLS_DC) +static php_sockbuf *php_sockfind(int socket TSRMLS_DC) { php_sockbuf *buf = NULL, *tmp; @@ -338,7 +337,7 @@ static php_sockbuf *php_sockfind(int socket FLS_DC) return buf; } -static php_sockbuf *php_sockcreate(int socket FLS_DC) +static php_sockbuf *php_sockcreate(int socket TSRMLS_DC) { php_sockbuf *sock; int persistent = php_is_persistent_sock(socket); @@ -365,7 +364,7 @@ PHPAPI php_sockbuf *php_get_socket(int socket) PHPAPI size_t php_sock_set_def_chunk_size(size_t size) { size_t old; - FLS_FETCH(); + TSRMLS_FETCH(); old = FG(def_chunk_size); @@ -379,9 +378,9 @@ PHPAPI int php_sockdestroy(int socket) { int ret = 0; php_sockbuf *sock; - FLS_FETCH(); + TSRMLS_FETCH(); - sock = php_sockfind(socket FLS_CC); + sock = php_sockfind(socket TSRMLS_CC); if(sock) { ret = 1; SOCK_DESTROY(sock); @@ -406,9 +405,9 @@ PHPAPI int php_sock_close(int socket) { int ret = 0; php_sockbuf *sock; - FLS_FETCH(); + TSRMLS_FETCH(); - sock = php_sockfind(socket FLS_CC); + sock = php_sockfind(socket TSRMLS_CC); if(sock) { if(!sock->persistent) { SOCK_CLOSE(sock->socket); @@ -753,9 +752,9 @@ PHPAPI void php_msock_destroy(int *data) PHP_RSHUTDOWN_FUNCTION(fsock) { - FLS_FETCH(); + TSRMLS_FETCH(); - php_cleanup_sockbuf(0 FLS_CC); + php_cleanup_sockbuf(0 TSRMLS_CC); return SUCCESS; } /* }}} */ diff --git a/ext/standard/fsock.h b/ext/standard/fsock.h index 9f369a8b27..814e442412 100644 --- a/ext/standard/fsock.h +++ b/ext/standard/fsock.h @@ -72,7 +72,7 @@ PHPAPI int php_sockdestroy(int socket); PHPAPI int php_sock_close(int socket); PHPAPI size_t php_sock_set_def_chunk_size(size_t size); PHPAPI void php_msock_destroy(int *data); -PHPAPI void php_cleanup_sockbuf(int persistent FLS_DC); +PHPAPI void php_cleanup_sockbuf(int persistent TSRMLS_DC); PHPAPI struct php_sockbuf *php_get_socket(int socket); diff --git a/ext/standard/head.c b/ext/standard/head.c index c84fee46df..b4df2645ff 100644 --- a/ext/standard/head.c +++ b/ext/standard/head.c @@ -59,7 +59,7 @@ PHP_FUNCTION(header) PHPAPI int php_header() { - SLS_FETCH(); + TSRMLS_FETCH(); if (sapi_send_headers()==FAILURE || SG(request_info).headers_only) { return 0; /* don't allow output */ @@ -84,7 +84,6 @@ PHP_FUNCTION(setcookie) pval **arg[6]; int arg_count; zval **z_name=NULL, **z_value=NULL, **z_path=NULL, **z_domain=NULL; - SLS_FETCH(); arg_count = ZEND_NUM_ARGS(); if (arg_count < 1 || arg_count > 6 || zend_get_parameters_array_ex(arg_count, arg) == FAILURE) { @@ -181,8 +180,6 @@ PHP_FUNCTION(setcookie) Return true if headers have already been sent, false otherwise */ PHP_FUNCTION(headers_sent) { - SLS_FETCH(); - if (SG(headers_sent)) { RETURN_TRUE; } else { diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index 9c09c78dcd..f83fb7b3ae 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -85,6 +85,7 @@ FILE *php_fopen_url_wrap_http(char *path, char *mode, int options, int *issock, zval *response_header; char *http_header_line; int http_header_line_length, http_header_line_size; + TSRMLS_FETCH(); resource = php_url_parse((char *) path); if (resource == NULL) { @@ -274,7 +275,6 @@ FILE *php_fopen_url_wrap_http(char *path, char *mode, int options, int *issock, php_url_free(resource); if (location[0] != '\0') { zval **response_header_new, *entry, **entryp; - TSRMLS_FETCH(); fp = php_fopen_url_wrap_http(location, mode, options, issock, socketd, opened_path); if (zend_hash_find(EG(active_symbol_table), "http_response_header", sizeof("http_response_header"), (void **) &response_header_new) == SUCCESS) { @@ -299,7 +299,6 @@ FILE *php_fopen_url_wrap_http(char *path, char *mode, int options, int *issock, *issock = 1; out: { - TSRMLS_FETCH(); ZEND_SET_SYMBOL(EG(active_symbol_table), "http_response_header", response_header); } return (fp); diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c index c0019282e8..3f8094596b 100644 --- a/ext/standard/incomplete_class.c +++ b/ext/standard/incomplete_class.c @@ -88,7 +88,7 @@ static zval incomplete_class_get_property(zend_property_reference *property_refe /* {{{ php_create_incomplete_class */ -zend_class_entry *php_create_incomplete_class(BLS_D) +zend_class_entry *php_create_incomplete_class(TSRMLS_D) { zend_class_entry incomplete_class; diff --git a/ext/standard/info.c b/ext/standard/info.c index dec141f331..fa1fef823e 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -153,7 +153,6 @@ PHPAPI void php_print_info(int flag) time_t the_time; struct tm *ta, tmbuf; TSRMLS_FETCH(); - SLS_FETCH(); the_time = time(NULL); ta = php_localtime_r(&the_time, &tmbuf); diff --git a/ext/standard/lcg.c b/ext/standard/lcg.c index 6f97a0397a..f0ba907d45 100644 --- a/ext/standard/lcg.c +++ b/ext/standard/lcg.c @@ -50,7 +50,7 @@ double php_combined_lcg(void) { php_int32 q; php_int32 z; - LCGLS_FETCH(); + TSRMLS_FETCH(); MODMULT(53668,40014,12211,2147483563L, LCG(s1)); MODMULT(52774,40692,3791, 2147483399L, LCG(s2)); @@ -63,7 +63,7 @@ double php_combined_lcg(void) return z * 4.656613e-10; } -static void lcg_init_globals(LCGLS_D TSRMLS_DC) +static void lcg_init_globals(php_lcg_globals *lcg_globals_p TSRMLS_DC) { LCG(s1) = 1; #ifdef ZTS @@ -83,7 +83,7 @@ PHP_MINIT_FUNCTION(lcg) PHP_RINIT_FUNCTION(lcg) { if (!php_lcg_initialized) { - lcg_init_globals(); + lcg_init_globals(&lcg_globals TSRMLS_CC); php_lcg_initialized = 1; } return SUCCESS; diff --git a/ext/standard/link.c b/ext/standard/link.c index c600be1fc3..e002018fc8 100644 --- a/ext/standard/link.c +++ b/ext/standard/link.c @@ -102,7 +102,6 @@ PHP_FUNCTION(symlink) { pval **topath, **frompath; int ret; - PLS_FETCH(); if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &topath, &frompath) == FAILURE) { WRONG_PARAM_COUNT; @@ -133,7 +132,6 @@ PHP_FUNCTION(link) { pval **topath, **frompath; int ret; - PLS_FETCH(); if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &topath, &frompath) == FAILURE) { WRONG_PARAM_COUNT; diff --git a/ext/standard/mail.c b/ext/standard/mail.c index a46d80a39c..406a219b66 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -81,7 +81,6 @@ PHP_FUNCTION(mail) pval **argv[5]; char *to=NULL, *message=NULL, *headers=NULL, *subject=NULL, *extra_cmd=NULL; int argc; - PLS_FETCH(); argc = ZEND_NUM_ARGS(); if (argc < 3 || argc > 5 || zend_get_parameters_array_ex(argc, argv) == FAILURE) { diff --git a/ext/standard/pageinfo.c b/ext/standard/pageinfo.c index fb8b74f0ce..5c52d97762 100644 --- a/ext/standard/pageinfo.c +++ b/ext/standard/pageinfo.c @@ -43,7 +43,7 @@ /* {{{ php_statpage */ -static void php_statpage(BLS_D) +static void php_statpage(TSRMLS_D) { struct stat *pstat; @@ -64,18 +64,18 @@ static void php_statpage(BLS_D) */ long php_getuid(void) { - BLS_FETCH(); + TSRMLS_FETCH(); - php_statpage(BLS_C); + php_statpage(TSRMLS_C); return (BG(page_uid)); } /* }}} */ long php_getgid(void) { - BLS_FETCH(); + TSRMLS_FETCH(); - php_statpage(BLS_C); + php_statpage(TSRMLS_C); return (BG(page_gid)); } @@ -128,9 +128,7 @@ PHP_FUNCTION(getmypid) Get the inode of the current script being parsed */ PHP_FUNCTION(getmyinode) { - BLS_FETCH(); - - php_statpage(BLS_C); + php_statpage(TSRMLS_C); if (BG(page_inode) < 0) { RETURN_FALSE; } else { @@ -143,9 +141,7 @@ PHP_FUNCTION(getmyinode) Get time of last page modification */ PHP_FUNCTION(getlastmod) { - BLS_FETCH(); - - php_statpage(BLS_C); + php_statpage(TSRMLS_C); if (BG(page_mtime) < 0) { RETURN_FALSE; } else { diff --git a/ext/standard/php_array.h b/ext/standard/php_array.h index 04ebb02167..d1aeefa24c 100644 --- a/ext/standard/php_array.h +++ b/ext/standard/php_array.h @@ -89,20 +89,10 @@ typedef struct { } php_array_globals; #ifdef ZTS -#define ARRAYLS_D php_array_globals *array_globals -#define ARRAYLS_DC , ARRAYLS_D -#define ARRAYLS_C array_globals -#define ARRAYLS_CC , ARRAYLS_C -#define ARRAYG(v) (array_globals->v) -#define ARRAYLS_FETCH() php_array_globals *array_globals = ts_resource(array_globals_id) +#define ARRAYG(v) TSRMG(array_globals_id, php_array_globals *, v) extern int array_globals_id; #else -#define ARRAYLS_D -#define ARRAYLS_DC -#define ARRAYLS_C -#define ARRAYLS_CC #define ARRAYG(v) (array_globals.v) -#define ARRAYLS_FETCH() extern php_array_globals array_globals; #endif diff --git a/ext/standard/php_incomplete_class.h b/ext/standard/php_incomplete_class.h index bfa876044e..29f9642e4f 100644 --- a/ext/standard/php_incomplete_class.h +++ b/ext/standard/php_incomplete_class.h @@ -27,7 +27,7 @@ BG(incomplete_class) #define PHP_IC_ENTRY_READ \ - (PHP_IC_ENTRY ? PHP_IC_ENTRY : php_create_incomplete_class(BLS_C)) + (PHP_IC_ENTRY ? PHP_IC_ENTRY : php_create_incomplete_class(TSRMLS_C)) #define PHP_SET_CLASS_ATTRIBUTES(struc) \ @@ -53,7 +53,7 @@ extern "C" { #endif -zend_class_entry *php_create_incomplete_class(BLS_D); +zend_class_entry *php_create_incomplete_class(TSRMLS_D); char *php_lookup_class_name(zval *object, size_t *nlen, zend_bool del); void php_store_class_name(zval *object, const char *name, size_t len); diff --git a/ext/standard/php_lcg.h b/ext/standard/php_lcg.h index 4abe6a13ce..e33600fe12 100644 --- a/ext/standard/php_lcg.h +++ b/ext/standard/php_lcg.h @@ -33,14 +33,10 @@ PHP_FUNCTION(lcg_value); #ifdef ZTS PHP_MINIT_FUNCTION(lcg); -#define LCGLS_D php_lcg_globals *lcg_globals -#define LCG(v) (lcg_globals->v) -#define LCGLS_FETCH() php_lcg_globals *lcg_globals = ts_resource(lcg_globals_id) +#define LCG(v) TSRMG(lcg_globals_id, php_lcg_globals *, v) #else PHP_RINIT_FUNCTION(lcg); -#define LCGLS_D void #define LCG(v) (lcg_globals.v) -#define LCGLS_FETCH() #endif #endif diff --git a/ext/standard/rand.c b/ext/standard/rand.c index 72227af0fd..c863419fa1 100644 --- a/ext/standard/rand.c +++ b/ext/standard/rand.c @@ -96,7 +96,7 @@ /* {{{ seedMT */ -static void seedMT(php_uint32 seed BLS_DC) +static void seedMT(php_uint32 seed TSRMLS_DC) { /* We initialize state[0..(N-1)] via the generator @@ -152,13 +152,13 @@ static void seedMT(php_uint32 seed BLS_DC) } /* }}} */ -static php_uint32 reloadMT(BLS_D) +static php_uint32 reloadMT(TSRMLS_D) { register php_uint32 *p0=BG(state), *p2=BG(state)+2, *pM=BG(state)+M, s0, s1; register int j; if(BG(left) < -1) - seedMT(4357U BLS_CC); + seedMT(4357U TSRMLS_CC); BG(left)=N-1, BG(next)=BG(state)+1; @@ -179,10 +179,10 @@ static php_uint32 reloadMT(BLS_D) static inline php_uint32 randomMT(void) { php_uint32 y; - BLS_FETCH(); + TSRMLS_FETCH(); if(--BG(left) < 0) - return(reloadMT(BLS_C)); + return(reloadMT(TSRMLS_C)); y = *BG(next)++; y ^= (y >> 11); @@ -210,13 +210,12 @@ PHP_FUNCTION(srand) PHP_FUNCTION(mt_srand) { pval **arg; - BLS_FETCH(); if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_long_ex(arg); - seedMT((*arg)->value.lval BLS_CC); + seedMT((*arg)->value.lval TSRMLS_CC); } /* }}} */ diff --git a/ext/standard/reg.c b/ext/standard/reg.c index c962f2b8c4..7116dad68a 100644 --- a/ext/standard/reg.c +++ b/ext/standard/reg.c @@ -53,7 +53,7 @@ static int _php_regcomp(regex_t *preg, const char *pattern, int cflags) int r = 0; int patlen = strlen(pattern); reg_cache *rc = NULL; - REGLS_FETCH(); + TSRMLS_FETCH(); if(zend_hash_find(®(ht_rc), (char *) pattern, patlen+1, (void **) &rc) == FAILURE || rc->cflags != cflags) { @@ -102,7 +102,7 @@ PHP_MINIT_FUNCTION(regex) PHP_MSHUTDOWN_FUNCTION(regex) { - REGLS_FETCH(); + TSRMLS_FETCH(); zend_hash_destroy(®(ht_rc)); return SUCCESS; diff --git a/ext/standard/reg.h b/ext/standard/reg.h index cb34b15e7c..c8adf74956 100644 --- a/ext/standard/reg.h +++ b/ext/standard/reg.h @@ -42,19 +42,9 @@ PHP_MINFO_FUNCTION(regex); #ifdef ZTS -#define REGLS_D php_reg_globals *reg_globals -#define REGLS_DC , REGLS_D -#define REGLS_C reg_globals -#define REGLS_CC , REGLS_C -#define REG(v) (reg_globals->v) -#define REGLS_FETCH() php_reg_globals *reg_globals = ts_resource(reg_globals_id) +#define REG(v) TSRMG(reg_globals_id, php_reg_globals *, v) #else -#define REGLS_D -#define REGLS_DC -#define REGLS_C -#define REGLS_CC #define REG(v) (reg_globals.v) -#define REGLS_FETCH() #endif #endif /* REG_H */ diff --git a/ext/standard/string.c b/ext/standard/string.c index 3f82017d63..c336da544a 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -814,7 +814,6 @@ PHP_FUNCTION(strtok) char *token = NULL, *tokp=NULL; char *first = NULL; int argc; - BLS_FETCH(); argc = ZEND_NUM_ARGS(); @@ -2026,7 +2025,7 @@ PHPAPI void php_stripslashes(char *str, int *len) char *s, *t; int l; char escape_char='\\'; - PLS_FETCH(); + TSRMLS_FETCH(); if (PG(magic_quotes_sybase)) { escape_char='\''; @@ -2156,7 +2155,7 @@ char *php_strerror(int errnum) { extern int sys_nerr; extern char *sys_errlist[]; - BLS_FETCH(); + TSRMLS_FETCH(); if ((unsigned int)errnum < sys_nerr) return(sys_errlist[errnum]); (void)sprintf(BG(str_ebuf), "Unknown error: %d", errnum); @@ -2298,7 +2297,7 @@ PHPAPI char *php_addslashes(char *str, int length, int *new_length, int should_f char *source,*target; char *end; char c; - PLS_FETCH(); + TSRMLS_FETCH(); if (!str) { *new_length = 0; @@ -2907,7 +2906,6 @@ PHP_FUNCTION(setlocale) zval *category, *locale; int cat; char *loc, *retval; - BLS_FETCH(); if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &pcategory, &plocale)==FAILURE) WRONG_PARAM_COUNT; @@ -2976,9 +2974,6 @@ PHP_FUNCTION(parse_str) char *res = NULL; int argCount; int old_rg; - - PLS_FETCH(); - SLS_FETCH(); argCount = ARG_COUNT(ht); if(argCount < 1 || argCount > 2 || zend_get_parameters_ex(argCount, &arg, &arrayArg) == FAILURE) { @@ -2994,14 +2989,14 @@ PHP_FUNCTION(parse_str) old_rg = PG(register_globals); if(argCount == 1) { PG(register_globals) = 1; - php_treat_data(PARSE_STRING, res, NULL TSRMLS_CC PLS_CC SLS_CC); + php_treat_data(PARSE_STRING, res, NULL TSRMLS_CC); } else { PG(register_globals) = 0; /* Clear out the array that was passed in. */ zval_dtor(*arrayArg); array_init(*arrayArg); - php_treat_data(PARSE_STRING, res, *arrayArg TSRMLS_CC PLS_CC SLS_CC); + php_treat_data(PARSE_STRING, res, *arrayArg TSRMLS_CC); } PG(register_globals) = old_rg; } diff --git a/ext/standard/syslog.c b/ext/standard/syslog.c index f6330facd3..0defb80b37 100644 --- a/ext/standard/syslog.c +++ b/ext/standard/syslog.c @@ -36,7 +36,7 @@ #include "basic_functions.h" #include "php_ext_syslog.h" -static void start_syslog(BLS_D); +static void start_syslog(TSRMLS_D); /* {{{ PHP_MINIT_FUNCTION */ @@ -104,10 +104,8 @@ PHP_MINIT_FUNCTION(syslog) PHP_RINIT_FUNCTION(syslog) { - BLS_FETCH(); - if (INI_INT("define_syslog_variables")) { - start_syslog(BLS_C); + start_syslog(TSRMLS_C); } else { BG(syslog_started)=0; } @@ -118,7 +116,7 @@ PHP_RINIT_FUNCTION(syslog) PHP_RSHUTDOWN_FUNCTION(syslog) { - BLS_FETCH(); + TSRMLS_FETCH(); if (BG(syslog_device)) { efree(BG(syslog_device)); @@ -128,10 +126,8 @@ PHP_RSHUTDOWN_FUNCTION(syslog) /* {{{ start_syslog */ -static void start_syslog(BLS_D) +static void start_syslog(TSRMLS_D) { - TSRMLS_FETCH(); - /* error levels */ SET_VAR_LONG("LOG_EMERG", LOG_EMERG); /* system unusable */ SET_VAR_LONG("LOG_ALERT", LOG_ALERT); /* immediate action required */ @@ -197,10 +193,8 @@ static void start_syslog(BLS_D) Initializes all syslog-related variables */ PHP_FUNCTION(define_syslog_variables) { - BLS_FETCH(); - if (!BG(syslog_started)) { - start_syslog(BLS_C); + start_syslog(TSRMLS_C); } } /* }}} */ @@ -215,7 +209,6 @@ PHP_FUNCTION(define_syslog_variables) PHP_FUNCTION(openlog) { pval **ident, **option, **facility; - BLS_FETCH(); if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &ident, &option, &facility) == FAILURE) { WRONG_PARAM_COUNT; @@ -236,8 +229,6 @@ PHP_FUNCTION(openlog) Close connection to system logger */ PHP_FUNCTION(closelog) { - BLS_FETCH(); - closelog(); if (BG(syslog_device)) { efree(BG(syslog_device)); diff --git a/ext/standard/url_scanner.c b/ext/standard/url_scanner.c index 57cdb60a4a..07b46f7fa2 100644 --- a/ext/standard/url_scanner.c +++ b/ext/standard/url_scanner.c @@ -52,7 +52,7 @@ PHP_RSHUTDOWN_FUNCTION(url_scanner) static char *url_attr_addon(const char *tag,const char *attr,const char *val,const char *buf) { int flag = 0; - PLS_FETCH(); + TSRMLS_FETCH(); if(!strcasecmp(tag,"a") && !strcasecmp(attr,"href")) { flag = 1; @@ -106,7 +106,7 @@ char *url_adapt(const char *src, size_t srclen, const char *data, size_t *newlen { char *out,*outp; int maxl,n; - BLS_FETCH(); + TSRMLS_FETCH(); if(src==NULL) { US.state=STATE_NORMAL; diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c index d8e49e74f8..b4c9dafecc 100644 --- a/ext/standard/url_scanner_ex.c +++ b/ext/standard/url_scanner_ex.c @@ -47,7 +47,7 @@ static PHP_INI_MH(OnUpdateTags) char *key; char *lasts; char *tmp; - BLS_FETCH(); + TSRMLS_FETCH(); ctx = &BG(url_adapt_state_ex); @@ -202,7 +202,7 @@ done: #undef YYLIMIT #undef YYMARKER -static inline void tag_arg(url_adapt_state_ex_t *ctx, char quote PLS_DC) +static inline void tag_arg(url_adapt_state_ex_t *ctx, char quote TSRMLS_DC) { char f = 0; @@ -234,8 +234,8 @@ enum { #define YYMARKER q #define STATE ctx->state -#define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR PLS_DC -#define STD_ARGS ctx, start, xp PLS_CC +#define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR TSRMLS_DC +#define STD_ARGS ctx, start, xp TSRMLS_CC static inline void passthru(STD_PARA) { @@ -283,7 +283,7 @@ static inline void handle_arg(STD_PARA) static inline void handle_val(STD_PARA, char quotes, char type) { smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2); - tag_arg(ctx, type PLS_CC); + tag_arg(ctx, type TSRMLS_CC); } #ifdef SCANNER_DEBUG @@ -298,7 +298,7 @@ static inline void mainloop(url_adapt_state_ex_t *ctx, const char *newdata, size char *xp; char *start; int rest; - PLS_FETCH(); + TSRMLS_FETCH(); smart_str_appendl(&ctx->buf, newdata, newlen); @@ -806,7 +806,7 @@ char *url_adapt_flush(size_t *newlen) { char *ret = NULL; url_adapt_state_ex_t *ctx; - BLS_FETCH(); + TSRMLS_FETCH(); ctx = &BG(url_adapt_state_ex); @@ -826,7 +826,7 @@ char *url_adapt_single_url(const char *url, size_t urllen, const char *name, con smart_str buf = {0}; smart_str sname = {0}; smart_str sval = {0}; - PLS_FETCH(); + TSRMLS_FETCH(); smart_str_setl(&surl, url, urllen); smart_str_sets(&sname, name); @@ -844,7 +844,7 @@ char *url_adapt_ext(const char *src, size_t srclen, const char *name, const char { char *ret; url_adapt_state_ex_t *ctx; - BLS_FETCH(); + TSRMLS_FETCH(); ctx = &BG(url_adapt_state_ex); @@ -863,7 +863,6 @@ char *url_adapt_ext(const char *src, size_t srclen, const char *name, const char PHP_RINIT_FUNCTION(url_scanner) { url_adapt_state_ex_t *ctx; - BLS_FETCH(); ctx = &BG(url_adapt_state_ex); @@ -875,7 +874,7 @@ PHP_RINIT_FUNCTION(url_scanner) PHP_RSHUTDOWN_FUNCTION(url_scanner) { url_adapt_state_ex_t *ctx; - BLS_FETCH(); + TSRMLS_FETCH(); ctx = &BG(url_adapt_state_ex); @@ -890,7 +889,7 @@ PHP_RSHUTDOWN_FUNCTION(url_scanner) PHP_MINIT_FUNCTION(url_scanner) { url_adapt_state_ex_t *ctx; - BLS_FETCH(); + //TSRMLS_FETCH(); ctx = &BG(url_adapt_state_ex); @@ -902,7 +901,7 @@ PHP_MINIT_FUNCTION(url_scanner) PHP_MSHUTDOWN_FUNCTION(url_scanner) { - BLS_FETCH(); + TSRMLS_FETCH(); UNREGISTER_INI_ENTRIES(); zend_hash_destroy(BG(url_adapt_state_ex).tags); diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re index 0d95d68ae5..009c6859fd 100644 --- a/ext/standard/url_scanner_ex.re +++ b/ext/standard/url_scanner_ex.re @@ -45,7 +45,7 @@ static PHP_INI_MH(OnUpdateTags) char *key; char *lasts; char *tmp; - BLS_FETCH(); + TSRMLS_FETCH(); ctx = &BG(url_adapt_state_ex); @@ -142,7 +142,7 @@ done: #undef YYLIMIT #undef YYMARKER -static inline void tag_arg(url_adapt_state_ex_t *ctx, char quote PLS_DC) +static inline void tag_arg(url_adapt_state_ex_t *ctx, char quote TSRMLS_DC) { char f = 0; @@ -174,8 +174,8 @@ enum { #define YYMARKER q #define STATE ctx->state -#define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR PLS_DC -#define STD_ARGS ctx, start, xp PLS_CC +#define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR TSRMLS_DC +#define STD_ARGS ctx, start, xp TSRMLS_CC static inline void passthru(STD_PARA) { @@ -223,7 +223,7 @@ static inline void handle_arg(STD_PARA) static inline void handle_val(STD_PARA, char quotes, char type) { smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2); - tag_arg(ctx, type PLS_CC); + tag_arg(ctx, type TSRMLS_CC); } #ifdef SCANNER_DEBUG @@ -238,7 +238,7 @@ static inline void mainloop(url_adapt_state_ex_t *ctx, const char *newdata, size char *xp; char *start; int rest; - PLS_FETCH(); + TSRMLS_FETCH(); smart_str_appendl(&ctx->buf, newdata, newlen); @@ -322,7 +322,7 @@ char *url_adapt_flush(size_t *newlen) { char *ret = NULL; url_adapt_state_ex_t *ctx; - BLS_FETCH(); + TSRMLS_FETCH(); ctx = &BG(url_adapt_state_ex); @@ -342,7 +342,7 @@ char *url_adapt_single_url(const char *url, size_t urllen, const char *name, con smart_str buf = {0}; smart_str sname = {0}; smart_str sval = {0}; - PLS_FETCH(); + TSRMLS_FETCH(); smart_str_setl(&surl, url, urllen); smart_str_sets(&sname, name); @@ -360,7 +360,7 @@ char *url_adapt_ext(const char *src, size_t srclen, const char *name, const char { char *ret; url_adapt_state_ex_t *ctx; - BLS_FETCH(); + TSRMLS_FETCH(); ctx = &BG(url_adapt_state_ex); @@ -379,7 +379,7 @@ char *url_adapt_ext(const char *src, size_t srclen, const char *name, const char PHP_RINIT_FUNCTION(url_scanner) { url_adapt_state_ex_t *ctx; - BLS_FETCH(); + TSRMLS_FETCH(); ctx = &BG(url_adapt_state_ex); @@ -391,7 +391,7 @@ PHP_RINIT_FUNCTION(url_scanner) PHP_RSHUTDOWN_FUNCTION(url_scanner) { url_adapt_state_ex_t *ctx; - BLS_FETCH(); + TSRMLS_FETCH(); ctx = &BG(url_adapt_state_ex); @@ -406,7 +406,7 @@ PHP_RSHUTDOWN_FUNCTION(url_scanner) PHP_MINIT_FUNCTION(url_scanner) { url_adapt_state_ex_t *ctx; - BLS_FETCH(); + TSRMLS_FETCH(); ctx = &BG(url_adapt_state_ex); @@ -418,7 +418,7 @@ PHP_MINIT_FUNCTION(url_scanner) PHP_MSHUTDOWN_FUNCTION(url_scanner) { - BLS_FETCH(); + TSRMLS_FETCH(); UNREGISTER_INI_ENTRIES(); zend_hash_destroy(BG(url_adapt_state_ex).tags); diff --git a/ext/standard/var.c b/ext/standard/var.c index 48ddba407b..90db80e8a6 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -184,7 +184,7 @@ PHPAPI void php_var_serialize(zval *buf, zval **struc, HashTable *var_hash) int i; ulong *var_already; HashTable *myht; - BLS_FETCH(); + TSRMLS_FETCH(); if(var_hash != NULL && php_add_var_hash(var_hash,*struc,(void *)&var_already) == FAILURE && (*struc)->is_ref) { slen = sprintf(s,"R:%ld;",*var_already); @@ -208,7 +208,6 @@ PHPAPI void php_var_serialize(zval *buf, zval **struc, HashTable *var_hash) return; case IS_DOUBLE: { - TSRMLS_FETCH(); slen = sprintf(s, "d:%.*G;",(int) EG(precision), Z_DVAL_PP(struc)); STR_CAT(buf, s, slen); } @@ -236,7 +235,6 @@ PHPAPI void php_var_serialize(zval *buf, zval **struc, HashTable *var_hash) zval *fname; int res; PHP_CLASS_ATTRIBUTES; - CLS_FETCH(); MAKE_STD_ZVAL(fname); ZVAL_STRING(fname,"__sleep",1); @@ -365,9 +363,7 @@ PHPAPI int php_var_unserialize(zval **rval, const char **p, const char *max, Has ulong id; HashTable *myht; zval **rval_ref; - TSRMLS_FETCH(); - BLS_FETCH(); if (var_hash && **p != 'R') { /* references aren't counted by serializer! */ zend_hash_next_index_insert(var_hash, rval, sizeof(*rval), NULL); @@ -583,7 +579,6 @@ PHPAPI int php_var_unserialize(zval **rval, const char **p, const char *max, Has if ((*rval)->type == IS_OBJECT) { zval *retval_ptr = NULL; zval *fname; - CLS_FETCH(); MAKE_STD_ZVAL(fname); ZVAL_STRING(fname,"__wakeup",1); |