summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2001-07-30 01:48:22 +0000
committerZeev Suraski <zeev@php.net>2001-07-30 01:48:22 +0000
commitb57703825be0ff40d34ee257ce14c453c4bffb98 (patch)
tree7504a2deef2f4e11ab340ade7b4b92eb6cdb7e15
parent0701d68f97a66e5435985fa495893b8a68c14533 (diff)
downloadphp-git-b57703825be0ff40d34ee257ce14c453c4bffb98.tar.gz
Avoid TSRMLS_FETCH()'s (still lots of work left)
-rw-r--r--Zend/zend.c18
-rw-r--r--Zend/zend_API.c30
-rw-r--r--Zend/zend_API.h12
-rw-r--r--Zend/zend_builtin_functions.c6
-rw-r--r--Zend/zend_builtin_functions.h2
-rw-r--r--Zend/zend_compile.h4
-rw-r--r--Zend/zend_constants.c2
-rw-r--r--Zend/zend_execute.c10
-rw-r--r--Zend/zend_execute_API.c4
-rw-r--r--Zend/zend_opcode.c2
10 files changed, 41 insertions, 49 deletions
diff --git a/Zend/zend.c b/Zend/zend.c
index 1f9d6ed522..7ac0c69fab 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -333,10 +333,8 @@ static void alloc_globals_ctor(zend_alloc_globals *alloc_globals_p TSRMLS_DC)
#endif
#ifdef ZTS
-static void zend_new_thread_end_handler(THREAD_T thread_id)
+static void zend_new_thread_end_handler(THREAD_T thread_id TSRMLS_DC)
{
- TSRMLS_FETCH();
-
zend_copy_ini_directives(TSRMLS_C);
zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP TSRMLS_CC);
}
@@ -420,7 +418,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
#endif
if (start_builtin_functions) {
- zend_startup_builtin_functions();
+ zend_startup_builtin_functions(TSRMLS_C);
}
zend_ini_startup(TSRMLS_C);
@@ -522,18 +520,17 @@ void zend_activate(TSRMLS_D)
}
-void zend_activate_modules()
+void zend_activate_modules(void)
{
- zend_hash_apply(&module_registry, (int (*)(void *)) module_registry_request_startup);
+ zend_hash_apply(&module_registry, (apply_func_t) module_registry_request_startup);
}
-void zend_deactivate_modules()
+void zend_deactivate_modules(TSRMLS_D)
{
- TSRMLS_FETCH();
EG(opline_ptr) = NULL; /* we're no longer executing anything */
zend_try {
- zend_hash_apply(&module_registry, (int (*)(void *)) module_registry_cleanup);
+ zend_hash_apply(&module_registry, (apply_func_t) module_registry_cleanup);
} zend_end_try();
}
@@ -780,12 +777,11 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, int file_count, ...)
#define COMPILED_STRING_DESCRIPTION_FORMAT "%s(%d) : %s"
-ZEND_API char *zend_make_compiled_string_description(char *name)
+ZEND_API char *zend_make_compiled_string_description(char *name TSRMLS_DC)
{
char *cur_filename;
int cur_lineno;
char *compiled_string_description;
- TSRMLS_FETCH();
if (zend_is_compiling()) {
cur_filename = zend_get_compiled_filename(TSRMLS_C);
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 6305346ecd..0bab090c5a 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -1025,7 +1025,7 @@ ZEND_API int zend_startup_module(zend_module_entry *module)
/* registers all functions in *library_functions in the function hash */
-int zend_register_functions(zend_function_entry *functions, HashTable *function_table, int type)
+int zend_register_functions(zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC)
{
zend_function_entry *ptr = functions;
zend_function function;
@@ -1033,7 +1033,6 @@ int zend_register_functions(zend_function_entry *functions, HashTable *function_
int count=0,unload=0;
HashTable *target_function_table = function_table;
int error_type;
- TSRMLS_FETCH();
if (type==MODULE_PERSISTENT) {
error_type = E_CORE_WARNING;
@@ -1052,7 +1051,7 @@ int zend_register_functions(zend_function_entry *functions, HashTable *function_
internal_function->function_name = ptr->fname;
if (!internal_function->handler) {
zend_error(error_type, "Null function defined as active function");
- zend_unregister_functions(functions, count, target_function_table);
+ zend_unregister_functions(functions, count, target_function_table TSRMLS_CC);
return FAILURE;
}
if (zend_hash_add(target_function_table, ptr->fname, strlen(ptr->fname)+1, &function, sizeof(zend_function), NULL) == FAILURE) {
@@ -1069,7 +1068,7 @@ int zend_register_functions(zend_function_entry *functions, HashTable *function_
}
ptr++;
}
- zend_unregister_functions(functions, count, target_function_table);
+ zend_unregister_functions(functions, count, target_function_table TSRMLS_CC);
return FAILURE;
}
return SUCCESS;
@@ -1078,12 +1077,11 @@ int zend_register_functions(zend_function_entry *functions, HashTable *function_
/* count=-1 means erase all functions, otherwise,
* erase the first count functions
*/
-void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table)
+void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC)
{
zend_function_entry *ptr = functions;
int i=0;
HashTable *target_function_table = function_table;
- TSRMLS_FETCH();
if (!target_function_table) {
target_function_table = CG(function_table);
@@ -1104,10 +1102,12 @@ void zend_unregister_functions(zend_function_entry *functions, int count, HashTa
ZEND_API int zend_register_module(zend_module_entry *module)
{
+ TSRMLS_FETCH();
+
#if 0
zend_printf("%s: Registering module %d\n",module->name, module->module_number);
#endif
- if (module->functions && zend_register_functions(module->functions, NULL, module->type)==FAILURE) {
+ if (module->functions && zend_register_functions(module->functions, NULL, module->type TSRMLS_CC)==FAILURE) {
zend_error(E_CORE_WARNING,"%s: Unable to register functions, unable to load",module->name);
return FAILURE;
}
@@ -1118,6 +1118,8 @@ ZEND_API int zend_register_module(zend_module_entry *module)
void module_destructor(zend_module_entry *module)
{
+ TSRMLS_FETCH();
+
if (module->type == MODULE_TEMPORARY) {
zend_clean_module_rsrc_dtors(module->module_number);
clean_module_constants(module->module_number);
@@ -1133,7 +1135,7 @@ void module_destructor(zend_module_entry *module)
}
module->module_started=0;
if (module->functions) {
- zend_unregister_functions(module->functions, -1, NULL);
+ zend_unregister_functions(module->functions, -1, NULL TSRMLS_CC);
}
#if HAVE_LIBDL
@@ -1196,10 +1198,9 @@ int zend_next_free_module(void)
* If both parent_ce and parent_name are NULL it does a regular class registration
* If parent_name is specified but not found NULL is returned
*/
-ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce, char *parent_name)
+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_class_entry *register_class;
- TSRMLS_FETCH();
if (!parent_ce && parent_name) {
if (zend_hash_find(CG(class_table), parent_name, strlen(parent_name)+1, (void **) &parent_ce)==FAILURE) {
@@ -1207,7 +1208,7 @@ ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *cla
}
}
- register_class = zend_register_internal_class(class_entry);
+ register_class = zend_register_internal_class(class_entry TSRMLS_CC);
if (parent_ce) {
zend_do_inheritance(register_class, parent_ce);
@@ -1215,11 +1216,10 @@ ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *cla
return register_class;
}
-ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *class_entry)
+ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *class_entry TSRMLS_DC)
{
zend_class_entry *register_class;
char *lowercase_name = zend_strndup(class_entry->name, class_entry->name_length);
- TSRMLS_FETCH();
zend_str_tolower(lowercase_name, class_entry->name_length);
@@ -1233,7 +1233,7 @@ ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *class_
if (class_entry->builtin_functions) {
- zend_register_functions(class_entry->builtin_functions, &class_entry->function_table, MODULE_PERSISTENT);
+ zend_register_functions(class_entry->builtin_functions, &class_entry->function_table, MODULE_PERSISTENT TSRMLS_CC);
}
zend_hash_update(CG(class_table), lowercase_name, class_entry->name_length+1, class_entry, sizeof(zend_class_entry), (void **) &register_class);
@@ -1298,7 +1298,7 @@ ZEND_API int zend_disable_function(char *function_name, uint function_name_lengt
return FAILURE;
}
disabled_function[0].fname = function_name;
- return zend_register_functions(disabled_function, CG(function_table), MODULE_PERSISTENT);
+ return zend_register_functions(disabled_function, CG(function_table), MODULE_PERSISTENT TSRMLS_CC);
}
zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char **callable_name)
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index 8c9618a2c5..db392d7ae6 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -42,16 +42,12 @@
#define ZEND_RINIT(module) zend_rinit_##module
#define ZEND_RSHUTDOWN(module) zend_rshutdown_##module
#define ZEND_MINFO(module) zend_info_##module
-#define ZEND_GINIT(module) zend_ginit_##module
-#define ZEND_GSHUTDOWN(module) zend_gshutdown_##module
#define ZEND_MINIT_FUNCTION(module) int ZEND_MINIT(module)(INIT_FUNC_ARGS)
#define ZEND_MSHUTDOWN_FUNCTION(module) int ZEND_MSHUTDOWN(module)(SHUTDOWN_FUNC_ARGS)
#define ZEND_RINIT_FUNCTION(module) int ZEND_RINIT(module)(INIT_FUNC_ARGS)
#define ZEND_RSHUTDOWN_FUNCTION(module) int ZEND_RSHUTDOWN(module)(SHUTDOWN_FUNC_ARGS)
#define ZEND_MINFO_FUNCTION(module) void ZEND_MINFO(module)(ZEND_MODULE_INFO_FUNC_ARGS)
-#define ZEND_GINIT_FUNCTION(module) int ZEND_GINIT(module)(GINIT_FUNC_ARGS)
-#define ZEND_GSHUTDOWN_FUNCTION(module) int ZEND_GSHUTDOWN(module)(void)
#define ZEND_GET_MODULE(name) \
ZEND_DLEXPORT zend_module_entry *get_module(void) { return &name##_module_entry; }
@@ -124,12 +120,12 @@ ZEND_API int zend_parse_parameters_ex(int flags, int num_args, char *type_spec,
ZEND_API int ParameterPassedByReference(int ht, uint n);
-int zend_register_functions(zend_function_entry *functions, HashTable *function_table, int type);
-void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table);
+int zend_register_functions(zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC);
+void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC);
ZEND_API int zend_register_module(zend_module_entry *module_entry);
-ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *class_entry);
-ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce, char *parent_name);
+ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *class_entry TSRMLS_DC);
+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);
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index 3bcb273d5b..d0b2fa60c7 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -122,9 +122,9 @@ static zend_function_entry builtin_functions[] = {
};
-int zend_startup_builtin_functions()
+int zend_startup_builtin_functions(TSRMLS_D)
{
- return zend_register_functions(builtin_functions, NULL, MODULE_PERSISTENT);
+ return zend_register_functions(builtin_functions, NULL, MODULE_PERSISTENT TSRMLS_CC);
}
@@ -947,7 +947,7 @@ ZEND_FUNCTION(create_function)
eval_code = (char *) emalloc(eval_code_length);
sprintf(eval_code, "function " LAMBDA_TEMP_FUNCNAME "(%s){%s}", Z_STRVAL_PP(z_function_args), Z_STRVAL_PP(z_function_code));
- eval_name = zend_make_compiled_string_description("runtime-created function");
+ eval_name = zend_make_compiled_string_description("runtime-created function" TSRMLS_CC);
retval = zend_eval_string(eval_code, NULL, eval_name TSRMLS_CC);
efree(eval_code);
efree(eval_name);
diff --git a/Zend/zend_builtin_functions.h b/Zend/zend_builtin_functions.h
index 574bc7fb19..bd144b1409 100644
--- a/Zend/zend_builtin_functions.h
+++ b/Zend/zend_builtin_functions.h
@@ -21,6 +21,6 @@
#ifndef ZEND_BUILTIN_FUNCTIONS_H
#define ZEND_BUILTIN_FUNCTIONS_H
-int zend_startup_builtin_functions(void);
+int zend_startup_builtin_functions(TSRMLS_D);
#endif /* ZEND_BUILTIN_FUNCTIONS_H */
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index b9d14b3c62..c9b9f6d989 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -205,7 +205,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_deactivate_modules(void);
+void zend_deactivate_modules(TSRMLS_D);
int lex_scan(zval *zendlval TSRMLS_DC);
@@ -388,7 +388,7 @@ void print_op_array(zend_op_array *op_array, int optimizations);
int pass_two(zend_op_array *op_array);
zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array);
ZEND_API zend_bool zend_is_compiling(void);
-ZEND_API char *zend_make_compiled_string_description(char *name);
+ZEND_API char *zend_make_compiled_string_description(char *name TSRMLS_DC);
int zendlex(znode *zendlval TSRMLS_DC);
diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c
index 6709b2b10f..59920c1404 100644
--- a/Zend/zend_constants.c
+++ b/Zend/zend_constants.c
@@ -160,7 +160,7 @@ void clean_non_persistent_constants(void)
{
TSRMLS_FETCH();
- zend_hash_apply(EG(zend_constants), (int (*)(void *)) clean_non_persistent_constant);
+ zend_hash_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant);
}
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 0f1b31d1a2..7dc80be5d3 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -937,9 +937,9 @@ 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), (int (*)()) zend_check_symbol); \
+ zend_hash_apply(&EG(symbol_table), (apply_func_t) zend_check_symbol); \
if (&EG(symbol_table)!=EG(active_symbol_table)) { \
- zend_hash_apply(EG(active_symbol_table), (int (*)()) zend_check_symbol); \
+ zend_hash_apply(EG(active_symbol_table), (apply_func_t) zend_check_symbol); \
}
static int zend_check_symbol(zval **pz)
@@ -947,9 +947,9 @@ static int zend_check_symbol(zval **pz)
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, (int (*)()) zend_check_symbol);
+ zend_hash_apply((*pz)->value.ht, (apply_func_t) zend_check_symbol);
} else if ((*pz)->type==IS_OBJECT) {
- zend_hash_apply((*pz)->value.obj.properties, (int (*)()) zend_check_symbol);
+ zend_hash_apply((*pz)->value.obj.properties, (apply_func_t) zend_check_symbol);
}
return 0;
@@ -2086,7 +2086,7 @@ send_by_ref:
new_op_array = compile_filename(opline->op2.u.constant.value.lval, inc_filename TSRMLS_CC);
break;
case ZEND_EVAL: {
- char *eval_desc = zend_make_compiled_string_description("eval()'d code");
+ char *eval_desc = zend_make_compiled_string_description("eval()'d code" TSRMLS_CC);
new_op_array = compile_string(inc_filename, eval_desc TSRMLS_CC);
efree(eval_desc);
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 42137cff0c..e2bc057aab 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -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), (int (*)(void *)) is_not_internal_function);
- zend_hash_apply(EG(class_table), (int (*)(void *)) is_not_internal_class);
+ 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_end_try();
zend_destroy_rsrc_list(TSRMLS_C); /* must be destroyed after the main symbol table and
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index 122cab58de..29c6d86c06 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -302,7 +302,7 @@ int pass_two(zend_op_array *op_array)
int print_class(zend_class_entry *class_entry)
{
printf("Class %s:\n", class_entry->name);
- zend_hash_apply(&class_entry->function_table, (int (*)(void *)) pass_two);
+ zend_hash_apply(&class_entry->function_table, (apply_func_t) pass_two);
printf("End of class %s.\n\n", class_entry->name);
return 0;
}