diff options
author | Zeev Suraski <zeev@php.net> | 2001-07-31 04:53:54 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 2001-07-31 04:53:54 +0000 |
commit | d76cf1da183f79711d7699a2ff85f743da3f9dd2 (patch) | |
tree | 8342fd3406696bc32b81deb28d6771336fb6fe36 /Zend | |
parent | 7bc71f442d7ddfecf43871b394c14100baa391b3 (diff) | |
download | php-git-d76cf1da183f79711d7699a2ff85f743da3f9dd2.tar.gz |
More TSRMLS_FETCH work
Diffstat (limited to 'Zend')
-rw-r--r-- | Zend/zend.c | 10 | ||||
-rw-r--r-- | Zend/zend.h | 2 | ||||
-rw-r--r-- | Zend/zend_API.c | 17 | ||||
-rw-r--r-- | Zend/zend_API.h | 2 | ||||
-rw-r--r-- | Zend/zend_builtin_functions.c | 10 | ||||
-rw-r--r-- | Zend/zend_compile.c | 2 | ||||
-rw-r--r-- | Zend/zend_compile.h | 6 | ||||
-rw-r--r-- | Zend/zend_constants.c | 8 | ||||
-rw-r--r-- | Zend/zend_execute.c | 32 | ||||
-rw-r--r-- | Zend/zend_execute.h | 2 | ||||
-rw-r--r-- | Zend/zend_execute_API.c | 21 | ||||
-rw-r--r-- | Zend/zend_extensions.c | 12 | ||||
-rw-r--r-- | Zend/zend_extensions.h | 2 | ||||
-rw-r--r-- | Zend/zend_hash.c | 6 | ||||
-rw-r--r-- | Zend/zend_hash.h | 6 | ||||
-rw-r--r-- | Zend/zend_ini.c | 20 | ||||
-rw-r--r-- | Zend/zend_list.c | 14 | ||||
-rw-r--r-- | Zend/zend_list.h | 2 | ||||
-rw-r--r-- | Zend/zend_llist.c | 12 | ||||
-rw-r--r-- | Zend/zend_llist.h | 12 | ||||
-rw-r--r-- | Zend/zend_modules.h | 4 | ||||
-rw-r--r-- | Zend/zend_opcode.c | 20 |
22 files changed, 107 insertions, 115 deletions
diff --git a/Zend/zend.c b/Zend/zend.c index fea898e9ce..a44c9bfd7b 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -431,7 +431,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i } -void zend_shutdown() +void zend_shutdown(TSRMLS_D) { #ifdef ZEND_WIN32 zend_shutdown_timeout_thread(); @@ -445,7 +445,7 @@ void zend_shutdown() free(GLOBAL_FUNCTION_TABLE); zend_hash_destroy(GLOBAL_CLASS_TABLE); free(GLOBAL_CLASS_TABLE); - zend_shutdown_extensions(); + zend_shutdown_extensions(TSRMLS_C); free(zend_version_info); #ifndef ZTS zend_shutdown_constants(); @@ -520,9 +520,9 @@ void zend_activate(TSRMLS_D) } -void zend_activate_modules(void) +void zend_activate_modules(TSRMLS_D) { - zend_hash_apply(&module_registry, (apply_func_t) module_registry_request_startup); + zend_hash_apply(&module_registry, (apply_func_t) module_registry_request_startup TSRMLS_CC); } void zend_deactivate_modules(TSRMLS_D) @@ -530,7 +530,7 @@ void zend_deactivate_modules(TSRMLS_D) EG(opline_ptr) = NULL; /* we're no longer executing anything */ zend_try { - zend_hash_apply(&module_registry, (apply_func_t) module_registry_cleanup); + zend_hash_apply(&module_registry, (apply_func_t) module_registry_cleanup TSRMLS_CC); } zend_end_try(); } diff --git a/Zend/zend.h b/Zend/zend.h index 2d171a40d9..5273a92b53 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -304,7 +304,7 @@ typedef int (*zend_write_func_t)(const char *str, uint str_length); #define BYREF_FORCE_REST 3 int zend_startup(zend_utility_functions *utility_functions, char **extensions, int start_builtin_functions); -void zend_shutdown(void); +void zend_shutdown(TSRMLS_D); void zend_set_utility_values(zend_utility_values *utility_values); diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 25cc7a034e..a46c3872f0 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -569,9 +569,10 @@ ZEND_API int _array_init(zval *arg ZEND_FILE_LINE_DC) ZEND_API int _object_init_ex(zval *arg, zend_class_entry *class_type ZEND_FILE_LINE_DC) { zval *tmp; + TSRMLS_FETCH(); if (!class_type->constants_updated) { - zend_hash_apply_with_argument(&class_type->default_properties, (int (*)(void *,void *)) zval_update_constant, (void *) 1); + zend_hash_apply_with_argument(&class_type->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC); class_type->constants_updated = 1; } @@ -1100,7 +1101,7 @@ void module_destructor(zend_module_entry *module) TSRMLS_FETCH(); if (module->type == MODULE_TEMPORARY) { - zend_clean_module_rsrc_dtors(module->module_number); + zend_clean_module_rsrc_dtors(module->module_number TSRMLS_CC); clean_module_constants(module->module_number TSRMLS_CC); if (module->request_shutdown_func) module->request_shutdown_func(module->type, module->module_number TSRMLS_CC); @@ -1126,11 +1127,9 @@ void module_destructor(zend_module_entry *module) /* call request startup for all modules */ -int module_registry_request_startup(zend_module_entry *module) +int module_registry_request_startup(zend_module_entry *module TSRMLS_DC) { if (module->request_startup_func) { - TSRMLS_FETCH(); - #if 0 zend_printf("%s: Request startup\n",module->name); #endif @@ -1146,10 +1145,8 @@ int module_registry_request_startup(zend_module_entry *module) /* for persistent modules - call request shutdown and flag NOT to erase * for temporary modules - do nothing, and flag to erase */ -int module_registry_cleanup(zend_module_entry *module) +int module_registry_cleanup(zend_module_entry *module TSRMLS_DC) { - TSRMLS_FETCH(); - switch(module->type) { case MODULE_PERSISTENT: if (module->request_shutdown_func) { @@ -1271,10 +1268,8 @@ static zend_function_entry disabled_function[] = { }; -ZEND_API int zend_disable_function(char *function_name, uint function_name_length) +ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC) { - TSRMLS_FETCH(); - if (zend_hash_del(CG(function_table), function_name, function_name_length+1)==FAILURE) { return FAILURE; } diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 29dcbc7e88..e8264590d3 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -130,7 +130,7 @@ ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *class_ ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce, char *parent_name TSRMLS_DC); ZEND_API zend_module_entry *zend_get_module(int module_number); -ZEND_API int zend_disable_function(char *function_name, uint function_name_length); +ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC); ZEND_API void zend_wrong_param_count(TSRMLS_D); ZEND_API zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char **callable_name); diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index b6defd3557..a0e5e67da4 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -553,7 +553,7 @@ ZEND_FUNCTION(get_class_vars) efree(lcname); array_init(return_value); if (!ce->constants_updated) { - zend_hash_apply_with_argument(&ce->default_properties, (int (*)(void *,void *)) zval_update_constant, (void *) 1); + zend_hash_apply_with_argument(&ce->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC); ce->constants_updated = 1; } zend_hash_copy(return_value->value.ht, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); @@ -1008,14 +1008,14 @@ ZEND_FUNCTION(get_resource_type) } -static int add_extension_info(zend_module_entry *module, void *arg) +static int add_extension_info(zend_module_entry *module, void *arg TSRMLS_DC) { zval *name_array = (zval *)arg; add_next_index_string(name_array, module->name, 1); return 0; } -static int add_constant_info(zend_constant *constant, void *arg) +static int add_constant_info(zend_constant *constant, void *arg TSRMLS_DC) { zval *name_array = (zval *)arg; zval *const_val; @@ -1037,7 +1037,7 @@ ZEND_FUNCTION(get_loaded_extensions) } array_init(return_value); - zend_hash_apply_with_argument(&module_registry, (int (*)(void *, void*)) add_extension_info, return_value); + zend_hash_apply_with_argument(&module_registry, (apply_func_arg_t) add_extension_info, return_value TSRMLS_CC); } /* }}} */ @@ -1051,7 +1051,7 @@ ZEND_FUNCTION(get_defined_constants) } array_init(return_value); - zend_hash_apply_with_argument(EG(zend_constants), (int (*)(void *, void*)) add_constant_info, return_value); + zend_hash_apply_with_argument(EG(zend_constants), (apply_func_arg_t) add_constant_info, return_value TSRMLS_CC); } diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 149c009aa2..04a992fd46 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -766,7 +766,7 @@ void zend_do_end_function_declaration(znode *function_token TSRMLS_DC) { zend_do_extended_info(TSRMLS_C); zend_do_return(NULL, 0 TSRMLS_CC); - pass_two(CG(active_op_array)); + pass_two(CG(active_op_array) TSRMLS_CC); CG(active_op_array) = function_token->u.op_array; /* Pop the switch and foreach seperators */ diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 6fd2ac1e77..fda7b57239 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -204,7 +204,7 @@ extern ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handl void zend_activate(TSRMLS_D); void zend_deactivate(TSRMLS_D); -void zend_activate_modules(void); +void zend_activate_modules(TSRMLS_D); void zend_deactivate_modules(TSRMLS_D); @@ -383,9 +383,9 @@ void zend_class_add_ref(zend_class_entry *ce); zend_op *get_next_op(zend_op_array *op_array TSRMLS_DC); void init_op(zend_op *op TSRMLS_DC); int get_next_op_number(zend_op_array *op_array); -int print_class(zend_class_entry *class_entry); +int print_class(zend_class_entry *class_entry TSRMLS_DC); void print_op_array(zend_op_array *op_array, int optimizations); -int pass_two(zend_op_array *op_array); +int pass_two(zend_op_array *op_array TSRMLS_DC); zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array); ZEND_API zend_bool zend_is_compiling(TSRMLS_D); ZEND_API char *zend_make_compiled_string_description(char *name TSRMLS_DC); diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index bf6a42c279..cb4ac03333 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -51,7 +51,7 @@ void zend_copy_constants(HashTable *target, HashTable *source) } -static int clean_non_persistent_constant(zend_constant *c) +static int clean_non_persistent_constant(zend_constant *c TSRMLS_DC) { if (c->flags & CONST_PERSISTENT) { return 0; @@ -61,7 +61,7 @@ static int clean_non_persistent_constant(zend_constant *c) } -static int clean_module_constant(zend_constant *c, int *module_number) +static int clean_module_constant(zend_constant *c, int *module_number TSRMLS_DC) { if (c->module_number == *module_number) { return 1; @@ -73,7 +73,7 @@ static int clean_module_constant(zend_constant *c, int *module_number) void clean_module_constants(int module_number TSRMLS_DC) { - zend_hash_apply_with_argument(EG(zend_constants), (int (*)(void *,void *)) clean_module_constant, (void *) &module_number); + zend_hash_apply_with_argument(EG(zend_constants), (apply_func_arg_t) clean_module_constant, (void *) &module_number TSRMLS_CC); } @@ -156,7 +156,7 @@ int zend_shutdown_constants(TSRMLS_D) void clean_non_persistent_constants(TSRMLS_D) { - zend_hash_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant); + zend_hash_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant TSRMLS_CC); } diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 3de49b8d54..6720bd014b 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -61,9 +61,9 @@ static void zend_fetch_var_address(znode *result, znode *op1, znode *op2, temp_v static void zend_fetch_dimension_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC); static void zend_fetch_property_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC); static void zend_fetch_dimension_address_from_tmp_var(znode *result, znode *op1, znode *op2, temp_variable *Ts TSRMLS_DC); -static void zend_extension_statement_handler(zend_extension *extension, zend_op_array *op_array); -static void zend_extension_fcall_begin_handler(zend_extension *extension, zend_op_array *op_array); -static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_array *op_array); +static void zend_extension_statement_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC); +static void zend_extension_fcall_begin_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC); +static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC); #define RETURN_VALUE_USED(opline) (!((opline)->result.u.EA.type & EXT_TYPE_UNUSED)) @@ -473,7 +473,7 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2 /* Utility Functions for Extensions */ -static void zend_extension_statement_handler(zend_extension *extension, zend_op_array *op_array) +static void zend_extension_statement_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) { if (extension->statement_handler) { extension->statement_handler(op_array); @@ -481,7 +481,7 @@ static void zend_extension_statement_handler(zend_extension *extension, zend_op_ } -static void zend_extension_fcall_begin_handler(zend_extension *extension, zend_op_array *op_array) +static void zend_extension_fcall_begin_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) { if (extension->fcall_begin_handler) { extension->fcall_begin_handler(op_array); @@ -489,7 +489,7 @@ static void zend_extension_fcall_begin_handler(zend_extension *extension, zend_o } -static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_array *op_array) +static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) { if (extension->fcall_end_handler) { extension->fcall_end_handler(op_array); @@ -561,7 +561,7 @@ static void zend_fetch_var_address(znode *result, znode *op1, znode *op2, temp_v if (op2->u.fetch_type == ZEND_FETCH_LOCAL) { FREE_OP(op1, free_op1); } else if (op2->u.fetch_type == ZEND_FETCH_STATIC) { - zval_update_constant(retval, (void *) 1); + zval_update_constant(retval, (void *) 1 TSRMLS_CC); } if (varname == &tmp_varname) { @@ -937,19 +937,19 @@ static void call_overloaded_function(temp_variable *T, int arg_count, zval *retu #if ZEND_INTENSIVE_DEBUGGING #define CHECK_SYMBOL_TABLES() \ - zend_hash_apply(&EG(symbol_table), (apply_func_t) zend_check_symbol); \ + zend_hash_apply(&EG(symbol_table), (apply_func_t) zend_check_symbol TSRMLS_CC); \ if (&EG(symbol_table)!=EG(active_symbol_table)) { \ - zend_hash_apply(EG(active_symbol_table), (apply_func_t) zend_check_symbol); \ + zend_hash_apply(EG(active_symbol_table), (apply_func_t) zend_check_symbol TSRMLS_CC); \ } -static int zend_check_symbol(zval **pz) +static int zend_check_symbol(zval **pz TSRMLS_DC) { if ((*pz)->type>9) { fprintf(stderr, "Warning! %x has invalid type!\n", *pz); } else if ((*pz)->type==IS_ARRAY) { - zend_hash_apply((*pz)->value.ht, (apply_func_t) zend_check_symbol); + zend_hash_apply((*pz)->value.ht, (apply_func_t) zend_check_symbol TSRMLS_CC); } else if ((*pz)->type==IS_OBJECT) { - zend_hash_apply((*pz)->value.obj.properties, (apply_func_t) zend_check_symbol); + zend_hash_apply((*pz)->value.obj.properties, (apply_func_t) zend_check_symbol TSRMLS_CC); } return 0; @@ -1793,7 +1793,7 @@ send_by_ref: zval_copy_ctor(default_value); } default_value->refcount=1; - zval_update_constant(&default_value, 0); + zval_update_constant(&default_value, 0 TSRMLS_CC); default_value->refcount=0; default_value->is_ref=0; param = &default_value; @@ -2375,17 +2375,17 @@ send_by_ref: NEXT_OPCODE(); case ZEND_EXT_STMT: if (!EG(no_extensions)) { - zend_llist_apply_with_argument(&zend_extensions, (void (*)(void *, void *)) zend_extension_statement_handler, op_array); + zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_statement_handler, op_array TSRMLS_CC); } NEXT_OPCODE(); case ZEND_EXT_FCALL_BEGIN: if (!EG(no_extensions)) { - zend_llist_apply_with_argument(&zend_extensions, (void (*)(void *, void *)) zend_extension_fcall_begin_handler, op_array); + zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_begin_handler, op_array TSRMLS_CC); } NEXT_OPCODE(); case ZEND_EXT_FCALL_END: if (!EG(no_extensions)) { - zend_llist_apply_with_argument(&zend_extensions, (void (*)(void *, void *)) zend_extension_fcall_end_handler, op_array); + zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_end_handler, op_array TSRMLS_CC); } NEXT_OPCODE(); case ZEND_DECLARE_FUNCTION_OR_CLASS: diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 9f52f3707d..9c25e8c0ef 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -101,7 +101,7 @@ static inline int i_zend_is_true(zval *op) return result; } -ZEND_API int zval_update_constant(zval **pp, void *arg); +ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC); /* dedicated Zend executor functions - do not use! */ static inline void zend_ptr_stack_clear_multiple(TSRMLS_D) diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 9646eaf49e..cf15349fec 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -74,7 +74,7 @@ static void zend_handle_sigsegv(int dummy) #endif -static void zend_extension_activator(zend_extension *extension) +static void zend_extension_activator(zend_extension *extension TSRMLS_DC) { if (extension->activate) { extension->activate(); @@ -82,7 +82,7 @@ static void zend_extension_activator(zend_extension *extension) } -static void zend_extension_deactivator(zend_extension *extension) +static void zend_extension_deactivator(zend_extension *extension TSRMLS_DC) { if (extension->deactivate) { extension->deactivate(); @@ -90,13 +90,13 @@ static void zend_extension_deactivator(zend_extension *extension) } -static int is_not_internal_function(zend_function *function) +static int is_not_internal_function(zend_function *function TSRMLS_DC) { return(function->type != ZEND_INTERNAL_FUNCTION); } -static int is_not_internal_class(zend_class_entry *ce) +static int is_not_internal_class(zend_class_entry *ce TSRMLS_DC) { return(ce->type != ZEND_INTERNAL_CLASS); } @@ -130,7 +130,7 @@ void init_executor(TSRMLS_D) zend_hash_init(&EG(symbol_table), 50, NULL, ZVAL_PTR_DTOR, 0); EG(active_symbol_table) = &EG(symbol_table); - zend_llist_apply(&zend_extensions, (void (*)(void *)) zend_extension_activator); + zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_activator TSRMLS_CC); EG(opline_ptr) = NULL; EG(garbage_ptr) = 0; @@ -160,7 +160,7 @@ void shutdown_executor(TSRMLS_D) efree(*EG(symtable_cache_ptr)); EG(symtable_cache_ptr)--; } - zend_llist_apply(&zend_extensions, (void (*)(void *)) zend_extension_deactivator); + zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_deactivator TSRMLS_CC); zend_hash_destroy(&EG(symbol_table)); @@ -173,8 +173,8 @@ void shutdown_executor(TSRMLS_D) zend_ptr_stack_destroy(&EG(argument_stack)); /* Destroy all op arrays */ - zend_hash_apply(EG(function_table), (apply_func_t) is_not_internal_function); - zend_hash_apply(EG(class_table), (apply_func_t) is_not_internal_class); + zend_hash_apply(EG(function_table), (apply_func_t) is_not_internal_function TSRMLS_CC); + zend_hash_apply(EG(class_table), (apply_func_t) is_not_internal_class TSRMLS_CC); } zend_end_try(); zend_destroy_rsrc_list(TSRMLS_C); /* must be destroyed after the main symbol table and @@ -271,12 +271,11 @@ ZEND_API int zend_is_true(zval *op) } -ZEND_API int zval_update_constant(zval **pp, void *arg) +ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC) { zval *p = *pp; zend_bool inline_change = (zend_bool) (unsigned long) arg; zval const_value; - TSRMLS_FETCH(); if (p->type == IS_CONSTANT) { int refcount; @@ -340,7 +339,7 @@ ZEND_API int zval_update_constant(zval **pp, void *arg) } zend_hash_del(p->value.ht, str_index, str_index_len); } - zend_hash_apply_with_argument(p->value.ht, (int (*)(void *,void *)) zval_update_constant, (void *) 1); + zend_hash_apply_with_argument(p->value.ht, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC); } return 0; } diff --git a/Zend/zend_extensions.c b/Zend/zend_extensions.c index 790490fa00..14b914cf8e 100644 --- a/Zend/zend_extensions.c +++ b/Zend/zend_extensions.c @@ -114,7 +114,7 @@ int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle) } -static void zend_extension_shutdown(zend_extension *extension) +static void zend_extension_shutdown(zend_extension *extension TSRMLS_DC) { #if ZEND_EXTENSIONS_SUPPORT if (extension->shutdown) { @@ -153,9 +153,9 @@ int zend_startup_extensions() } -void zend_shutdown_extensions() +void zend_shutdown_extensions(TSRMLS_D) { - zend_llist_apply(&zend_extensions, (void (*)(void *)) zend_extension_shutdown); + zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_shutdown TSRMLS_CC); zend_llist_destroy(&zend_extensions); } @@ -170,7 +170,7 @@ void zend_extension_dtor(zend_extension *extension) } -static void zend_extension_message_dispatcher(zend_extension *extension, int num_args, va_list args) +static void zend_extension_message_dispatcher(zend_extension *extension, int num_args, va_list args TSRMLS_DC) { int message; void *arg; @@ -186,7 +186,9 @@ static void zend_extension_message_dispatcher(zend_extension *extension, int num ZEND_API void zend_extension_dispatch_message(int message, void *arg) { - zend_llist_apply_with_arguments(&zend_extensions, (llist_apply_with_args_func_t) zend_extension_message_dispatcher, 2, message, arg); + TSRMLS_FETCH(); + + zend_llist_apply_with_arguments(&zend_extensions, (llist_apply_with_args_func_t) zend_extension_message_dispatcher TSRMLS_CC, 2, message, arg); } diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h index a31bd9cf91..c7839262e5 100644 --- a/Zend/zend_extensions.h +++ b/Zend/zend_extensions.h @@ -110,7 +110,7 @@ ZEND_API int zend_register_extension(zend_extension *new_extension, DL_HANDLE ha void zend_append_version_info(zend_extension *extension); int zend_startup_extensions_mechanism(void); int zend_startup_extensions(void); -void zend_shutdown_extensions(void); +void zend_shutdown_extensions(TSRMLS_D); ZEND_API zend_extension *zend_get_extension(char *extension_name); #endif /* ZEND_EXTENSIONS_H */ diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 6b6bb7e171..0078a53893 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -683,7 +683,7 @@ ZEND_API void zend_hash_graceful_destroy(HashTable *ht) */ -ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func) +ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC) { Bucket *p; @@ -692,7 +692,7 @@ ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func) HASH_PROTECT_RECURSION(ht); p = ht->pListHead; while (p != NULL) { - if (apply_func(p->pData)) { + if (apply_func(p->pData TSRMLS_CC)) { p = zend_hash_apply_deleter(ht, p); } else { p = p->pListNext; @@ -702,7 +702,7 @@ ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func) } -ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t apply_func, void *argument) +ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t apply_func, void *argument TSRMLS_DC) { Bucket *p; diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index c19a38c26d..e14b6c62f8 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -37,7 +37,7 @@ typedef ulong (*hash_func_t)(char *arKey, uint nKeyLength); typedef int (*compare_func_t)(const void *, const void *); typedef void (*sort_func_t)(void *, size_t, register size_t, compare_func_t); typedef void (*dtor_func_t)(void *pDest); -typedef int (*apply_func_t)(void *pDest); +typedef int (*apply_func_t)(void *pDest TSRMLS_DC); typedef int (*apply_func_arg_t)(void *pDest, void *argument); typedef void (*copy_ctor_func_t)(void *pElement); @@ -116,8 +116,8 @@ typedef struct _zend_hash_key { typedef int (*apply_func_args_t)(void *pDest, int num_args, va_list args, zend_hash_key *hash_key); ZEND_API void zend_hash_graceful_destroy(HashTable *ht); -ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func); -ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t apply_func, void *); +ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC); +ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t apply_func, void * TSRMLS_DC); ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, apply_func_args_t apply_func, int, ...); diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index 7595b8259a..fac8ab4e03 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -31,7 +31,7 @@ static HashTable *registered_zend_ini_directives; /* * hash_apply functions */ -static int zend_remove_ini_entries(zend_ini_entry *ini_entry, int *module_number) +static int zend_remove_ini_entries(zend_ini_entry *ini_entry, int *module_number TSRMLS_DC) { if (ini_entry->module_number == *module_number) { return 1; @@ -41,10 +41,8 @@ static int zend_remove_ini_entries(zend_ini_entry *ini_entry, int *module_number } -static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage) +static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage TSRMLS_DC) { - TSRMLS_FETCH(); - if (ini_entry->modified) { if (ini_entry->on_modify) { ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->orig_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC); @@ -81,7 +79,7 @@ ZEND_API int zend_ini_shutdown(TSRMLS_D) ZEND_API int zend_ini_deactivate(TSRMLS_D) { - zend_hash_apply_with_argument(&EG(ini_directives), (int (*)(void *, void *)) zend_restore_ini_entry_cb, (void *) ZEND_INI_STAGE_DEACTIVATE); + zend_hash_apply_with_argument(&EG(ini_directives), (apply_func_arg_t) zend_restore_ini_entry_cb, (void *) ZEND_INI_STAGE_DEACTIVATE TSRMLS_CC); return SUCCESS; } @@ -159,14 +157,14 @@ ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_num ZEND_API void zend_unregister_ini_entries(int module_number) { - zend_hash_apply_with_argument(registered_zend_ini_directives, (int (*)(void *, void *)) zend_remove_ini_entries, (void *) &module_number); + TSRMLS_FETCH(); + + zend_hash_apply_with_argument(registered_zend_ini_directives, (apply_func_arg_t) zend_remove_ini_entries, (void *) &module_number TSRMLS_CC); } -static int zend_ini_refresh_cache(zend_ini_entry *p, int stage) +static int zend_ini_refresh_cache(zend_ini_entry *p, int stage TSRMLS_DC) { - TSRMLS_FETCH(); - if (p->on_modify) { p->on_modify(p, p->value, p->value_length, p->mh_arg1, p->mh_arg2, p->mh_arg3, stage TSRMLS_CC); } @@ -176,7 +174,7 @@ static int zend_ini_refresh_cache(zend_ini_entry *p, int stage) ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC) { - zend_hash_apply_with_argument(&EG(ini_directives), (int (*)(void *, void *)) zend_ini_refresh_cache, (void *)(long) stage); + zend_hash_apply_with_argument(&EG(ini_directives), (apply_func_arg_t) zend_ini_refresh_cache, (void *)(long) stage TSRMLS_CC); } @@ -224,7 +222,7 @@ ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage) return FAILURE; } - zend_restore_ini_entry_cb(ini_entry, stage); + zend_restore_ini_entry_cb(ini_entry, stage TSRMLS_CC); return SUCCESS; } diff --git a/Zend/zend_list.c b/Zend/zend_list.c index 4cd588367f..db418ac186 100644 --- a/Zend/zend_list.c +++ b/Zend/zend_list.c @@ -263,7 +263,7 @@ void zend_destroy_rsrc_plist(TSRMLS_D) } -static int clean_module_resource(zend_rsrc_list_entry *le, int *resource_id) +static int clean_module_resource(zend_rsrc_list_entry *le, int *resource_id TSRMLS_DC) { if (le->type == *resource_id) { return 1; @@ -273,13 +273,11 @@ static int clean_module_resource(zend_rsrc_list_entry *le, int *resource_id) } -static int zend_clean_module_rsrc_dtors_cb(zend_rsrc_list_dtors_entry *ld, int *module_number) +static int zend_clean_module_rsrc_dtors_cb(zend_rsrc_list_dtors_entry *ld, int *module_number TSRMLS_DC) { if (ld->module_number == *module_number) { - TSRMLS_FETCH(); - - zend_hash_apply_with_argument(&EG(regular_list), (int (*)(void *,void *)) clean_module_resource, (void *) &(ld->resource_id)); - zend_hash_apply_with_argument(&EG(persistent_list), (int (*)(void *,void *)) clean_module_resource, (void *) &(ld->resource_id)); + zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) clean_module_resource, (void *) &(ld->resource_id) TSRMLS_CC); + zend_hash_apply_with_argument(&EG(persistent_list), (apply_func_arg_t) clean_module_resource, (void *) &(ld->resource_id) TSRMLS_CC); return 1; } else { return 0; @@ -287,9 +285,9 @@ static int zend_clean_module_rsrc_dtors_cb(zend_rsrc_list_dtors_entry *ld, int * } -void zend_clean_module_rsrc_dtors(int module_number) +void zend_clean_module_rsrc_dtors(int module_number TSRMLS_DC) { - zend_hash_apply_with_argument(&list_destructors, (int (*)(void *,void *)) zend_clean_module_rsrc_dtors_cb, (void *) &module_number); + zend_hash_apply_with_argument(&list_destructors, (apply_func_arg_t) zend_clean_module_rsrc_dtors_cb, (void *) &module_number TSRMLS_CC); } diff --git a/Zend/zend_list.h b/Zend/zend_list.h index f3b414e4da..0b75115233 100644 --- a/Zend/zend_list.h +++ b/Zend/zend_list.h @@ -65,7 +65,7 @@ enum list_entry_type { void list_entry_destructor(void *ptr); void plist_entry_destructor(void *ptr); -void zend_clean_module_rsrc_dtors(int module_number); +void zend_clean_module_rsrc_dtors(int module_number TSRMLS_DC); int zend_init_rsrc_list(TSRMLS_D); int zend_init_rsrc_plist(TSRMLS_D); void zend_destroy_rsrc_list(TSRMLS_D); diff --git a/Zend/zend_llist.c b/Zend/zend_llist.c index a85492c396..e3ac9a6d73 100644 --- a/Zend/zend_llist.c +++ b/Zend/zend_llist.c @@ -158,12 +158,12 @@ ZEND_API void zend_llist_apply_with_del(zend_llist *l, int (*func)(void *data)) } -ZEND_API void zend_llist_apply(zend_llist *l, void (*func)(void *data)) +ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func TSRMLS_DC) { zend_llist_element *element; for (element=l->head; element; element=element->next) { - func(element->data); + func(element->data TSRMLS_CC); } } @@ -205,24 +205,24 @@ ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func) } -ZEND_API void zend_llist_apply_with_argument(zend_llist *l, void (*func)(void *data, void *arg), void *arg) +ZEND_API void zend_llist_apply_with_argument(zend_llist *l, llist_apply_with_arg_func_t func, void *arg TSRMLS_DC) { zend_llist_element *element; for (element=l->head; element; element=element->next) { - func(element->data, arg); + func(element->data, arg TSRMLS_CC); } } -ZEND_API void zend_llist_apply_with_arguments(zend_llist *l, llist_apply_with_args_func_t func, int num_args, ...) +ZEND_API void zend_llist_apply_with_arguments(zend_llist *l, llist_apply_with_args_func_t func TSRMLS_DC, int num_args, ...) { zend_llist_element *element; va_list args; va_start(args, num_args); for (element=l->head; element; element=element->next) { - func(element->data, num_args, args); + func(element->data, num_args, args TSRMLS_CC); } va_end(args); } diff --git a/Zend/zend_llist.h b/Zend/zend_llist.h index 420c214e1a..63bf647483 100644 --- a/Zend/zend_llist.h +++ b/Zend/zend_llist.h @@ -31,9 +31,9 @@ typedef struct _zend_llist_element { typedef void (*llist_dtor_func_t)(void *); typedef int (*llist_compare_func_t)(const zend_llist_element *, const zend_llist_element *); -typedef void (*llist_apply_with_arg_func_t)(void *data, void *arg); -typedef void (*llist_apply_with_args_func_t)(void *data, int num_args, va_list args); -typedef void (*llist_apply_func_t)(void *); +typedef void (*llist_apply_with_args_func_t)(void *data, int num_args, va_list args TSRMLS_DC); +typedef void (*llist_apply_with_arg_func_t)(void *data, void *arg TSRMLS_DC); +typedef void (*llist_apply_func_t)(void * TSRMLS_DC); typedef struct _zend_llist { zend_llist_element *head; @@ -55,10 +55,10 @@ ZEND_API void zend_llist_destroy(zend_llist *l); ZEND_API void zend_llist_clean(zend_llist *l); ZEND_API void zend_llist_remove_tail(zend_llist *l); ZEND_API void zend_llist_copy(zend_llist *dst, zend_llist *src); -ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t); +ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func TSRMLS_DC); ZEND_API void zend_llist_apply_with_del(zend_llist *l, int (*func)(void *data)); -ZEND_API void zend_llist_apply_with_argument(zend_llist *l, llist_apply_with_arg_func_t, void *arg); -ZEND_API void zend_llist_apply_with_arguments(zend_llist *l, llist_apply_with_args_func_t func, int num_args, ...); +ZEND_API void zend_llist_apply_with_argument(zend_llist *l, llist_apply_with_arg_func_t func, void *arg TSRMLS_DC); +ZEND_API void zend_llist_apply_with_arguments(zend_llist *l, llist_apply_with_args_func_t func TSRMLS_DC, int num_args, ...); ZEND_API int zend_llist_count(zend_llist *l); ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func); diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h index e2aa72ad9a..24d40be251 100644 --- a/Zend/zend_modules.h +++ b/Zend/zend_modules.h @@ -77,8 +77,8 @@ struct _zend_module_entry { extern ZEND_API HashTable module_registry; void module_destructor(zend_module_entry *module); -int module_registry_cleanup(zend_module_entry *module); -int module_registry_request_startup(zend_module_entry *module); +int module_registry_cleanup(zend_module_entry *module TSRMLS_DC); +int module_registry_request_startup(zend_module_entry *module TSRMLS_DC); #define ZEND_MODULE_DTOR (void (*)(void *)) module_destructor #endif diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 29c6d86c06..6462d3e497 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -27,7 +27,7 @@ #include "zend_API.h" -static void zend_extension_op_array_ctor_handler(zend_extension *extension, zend_op_array *op_array) +static void zend_extension_op_array_ctor_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) { if (extension->op_array_ctor) { extension->op_array_ctor(op_array); @@ -35,7 +35,7 @@ static void zend_extension_op_array_ctor_handler(zend_extension *extension, zend } -static void zend_extension_op_array_dtor_handler(zend_extension *extension, zend_op_array *op_array) +static void zend_extension_op_array_dtor_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) { if (extension->op_array_dtor) { extension->op_array_dtor(op_array); @@ -89,7 +89,7 @@ void init_op_array(zend_op_array *op_array, int type, int initial_ops_size TSRML op_array->start_op = NULL; - zend_llist_apply_with_argument(&zend_extensions, (void (*)(void *, void *)) zend_extension_op_array_ctor_handler, op_array); + zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_ctor_handler, op_array TSRMLS_CC); } @@ -138,6 +138,7 @@ ZEND_API void destroy_op_array(zend_op_array *op_array) { zend_op *opline = op_array->opcodes; zend_op *end = op_array->opcodes+op_array->last; + TSRMLS_FETCH(); if (op_array->static_variables) { zend_hash_destroy(op_array->static_variables); @@ -176,7 +177,7 @@ ZEND_API void destroy_op_array(zend_op_array *op_array) efree(op_array->brk_cont_array); } if (op_array->done_pass_two) { - zend_llist_apply_with_argument(&zend_extensions, (void (*)(void *, void *)) zend_extension_op_array_dtor_handler, op_array); + zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_dtor_handler, op_array TSRMLS_CC); } } @@ -256,7 +257,7 @@ static void zend_update_extended_info(zend_op_array *op_array TSRMLS_DC) -static void zend_extension_op_array_handler(zend_extension *extension, zend_op_array *op_array) +static void zend_extension_op_array_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC) { if (extension->op_array_handler) { extension->op_array_handler(op_array); @@ -264,10 +265,9 @@ static void zend_extension_op_array_handler(zend_extension *extension, zend_op_a } -int pass_two(zend_op_array *op_array) +int pass_two(zend_op_array *op_array TSRMLS_DC) { zend_op *opline, *end; - TSRMLS_FETCH(); if (op_array->type!=ZEND_USER_FUNCTION && op_array->type!=ZEND_EVAL_CODE) { return 0; @@ -276,7 +276,7 @@ int pass_two(zend_op_array *op_array) zend_update_extended_info(op_array TSRMLS_CC); } if (CG(handle_op_arrays)) { - zend_llist_apply_with_argument(&zend_extensions, (void (*)(void *, void *)) zend_extension_op_array_handler, op_array); + zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_handler, op_array TSRMLS_CC); } opline = op_array->opcodes; @@ -299,10 +299,10 @@ int pass_two(zend_op_array *op_array) } -int print_class(zend_class_entry *class_entry) +int print_class(zend_class_entry *class_entry TSRMLS_DC) { printf("Class %s:\n", class_entry->name); - zend_hash_apply(&class_entry->function_table, (apply_func_t) pass_two); + zend_hash_apply(&class_entry->function_table, (apply_func_t) pass_two TSRMLS_CC); printf("End of class %s.\n\n", class_entry->name); return 0; } |