Permalink
Browse files

Get rid of ELS_*(), and use TSRMLS_*() instead.

This patch is *bound* to break some files, as I must have had typos somewhere.
If you use any uncommon extension, please try to build it...
  • Loading branch information...
1 parent 736b4ae commit 2c254ba762d9392a732d5793b5b193ee6e395f1c @zsuraski zsuraski committed Jul 27, 2001
View
@@ -261,7 +261,7 @@ static void zend_set_default_compile_time_values(CLS_D)
#ifdef ZTS
-static void compiler_globals_ctor(zend_compiler_globals *compiler_globals)
+static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS_DC)
{
zend_function tmp_func;
zend_class_entry tmp_class;
@@ -282,7 +282,7 @@ static void compiler_globals_ctor(zend_compiler_globals *compiler_globals)
}
-static void compiler_globals_dtor(zend_compiler_globals *compiler_globals)
+static void compiler_globals_dtor(zend_compiler_globals *compiler_globals TSRMLS_DC)
{
if (compiler_globals->function_table != global_function_table) {
zend_hash_destroy(compiler_globals->function_table);
@@ -295,28 +295,28 @@ static void compiler_globals_dtor(zend_compiler_globals *compiler_globals)
}
-static void executor_globals_ctor(zend_executor_globals *executor_globals)
+static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS_DC)
{
if (global_constants_table) {
- zend_startup_constants(ELS_C);
- zend_copy_constants(executor_globals->zend_constants, global_constants_table);
+ zend_startup_constants(TSRMLS_C);
+ zend_copy_constants(EG(zend_constants), global_constants_table);
}
- zend_init_rsrc_plist(ELS_C);
+ zend_init_rsrc_plist(TSRMLS_C);
EG(lambda_count)=0;
EG(user_error_handler) = NULL;
EG(in_execution) = 0;
}
-static void executor_globals_dtor(zend_executor_globals *executor_globals)
+static void executor_globals_dtor(zend_executor_globals *executor_globals TSRMLS_DC)
{
- zend_shutdown_constants(ELS_C);
- zend_destroy_rsrc_plist(ELS_C);
- zend_ini_shutdown(ELS_C);
+ zend_shutdown_constants(TSRMLS_C);
+ zend_destroy_rsrc_plist(TSRMLS_C);
+ zend_ini_shutdown(TSRMLS_C);
}
-static void alloc_globals_ctor(zend_alloc_globals *alloc_globals)
+static void alloc_globals_ctor(zend_alloc_globals *alloc_globals TSRMLS_DC)
{
start_memory_manager(ALS_C);
}
@@ -331,10 +331,10 @@ static void alloc_globals_ctor(zend_alloc_globals *alloc_globals)
#ifdef ZTS
static void zend_new_thread_end_handler(THREAD_T thread_id)
{
- ELS_FETCH();
+ TSRMLS_FETCH();
- zend_copy_ini_directives(ELS_C);
- zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP ELS_CC);
+ zend_copy_ini_directives(TSRMLS_C);
+ zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP TSRMLS_CC);
}
#endif
@@ -344,8 +344,9 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
#ifdef ZTS
zend_compiler_globals *compiler_globals;
zend_executor_globals *executor_globals;
+ void ***tsrm_ls;
- alloc_globals_id = ts_allocate_id(sizeof(zend_alloc_globals), (ts_allocate_ctor) alloc_globals_ctor, NULL);
+ ts_allocate_id(&alloc_globals_id, sizeof(zend_alloc_globals), (ts_allocate_ctor) alloc_globals_ctor, NULL);
#else
start_memory_manager(ALS_C);
#endif
@@ -393,31 +394,32 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
#ifdef ZTS
global_constants_table = NULL;
- compiler_globals_id = ts_allocate_id(sizeof(zend_compiler_globals), (void (*)(void *)) compiler_globals_ctor, (void (*)(void *)) compiler_globals_dtor);
- executor_globals_id = ts_allocate_id(sizeof(zend_executor_globals), (void (*)(void *)) executor_globals_ctor, (void (*)(void *)) executor_globals_dtor);
+ ts_allocate_id(&compiler_globals_id, sizeof(zend_compiler_globals), (ts_allocate_ctor) compiler_globals_ctor, (ts_allocate_dtor) compiler_globals_dtor);
+ ts_allocate_id(&executor_globals_id, sizeof(zend_executor_globals), (ts_allocate_ctor) executor_globals_ctor, (ts_allocate_dtor) executor_globals_dtor);
compiler_globals = ts_resource(compiler_globals_id);
executor_globals = ts_resource(executor_globals_id);
- compiler_globals_dtor(compiler_globals);
+ tsrm_ls = ts_resource_ex(0, NULL);
+ compiler_globals_dtor(compiler_globals, tsrm_ls);
compiler_globals->function_table = GLOBAL_FUNCTION_TABLE;
compiler_globals->class_table = GLOBAL_CLASS_TABLE;
- zend_startup_constants(executor_globals);
+ zend_startup_constants(tsrm_ls);
GLOBAL_CONSTANTS_TABLE = EG(zend_constants);
#else
zend_startup_constants();
zend_set_default_compile_time_values(CLS_C);
EG(user_error_handler) = NULL;
#endif
- zend_register_standard_constants(ELS_C);
+ zend_register_standard_constants(TSRMLS_C);
#ifndef ZTS
- zend_init_rsrc_plist(ELS_C);
+ zend_init_rsrc_plist(TSRMLS_C);
#endif
if (start_builtin_functions) {
zend_startup_builtin_functions();
}
- zend_ini_startup(ELS_C);
+ zend_ini_startup(TSRMLS_C);
#ifdef ZTS
tsrm_set_new_thread_end_handler(zend_new_thread_end_handler);
@@ -467,7 +469,7 @@ BEGIN_EXTERN_C()
ZEND_API void _zend_bailout(char *filename, uint lineno)
{
CLS_FETCH();
- ELS_FETCH();
+ TSRMLS_FETCH();
if (!EG(bailout_set)) {
zend_output_debug_string(1, "%s(%d) : Bailed out without a bailout address!", filename, lineno);
@@ -508,11 +510,11 @@ ZEND_API char *get_zend_version()
}
-void zend_activate(CLS_D ELS_DC)
+void zend_activate(CLS_D TSRMLS_DC)
{
EG(bailout_set) = 0;
- init_compiler(CLS_C ELS_CC);
- init_executor(CLS_C ELS_CC);
+ init_compiler(CLS_C TSRMLS_CC);
+ init_executor(CLS_C TSRMLS_CC);
startup_scanner(CLS_C);
}
@@ -524,15 +526,15 @@ void zend_activate_modules()
void zend_deactivate_modules()
{
- ELS_FETCH();
+ 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_end_try();
}
-void zend_deactivate(CLS_D ELS_DC)
+void zend_deactivate(CLS_D TSRMLS_DC)
{
/* we're no longer executing anything */
EG(opline_ptr) = NULL;
@@ -543,14 +545,14 @@ void zend_deactivate(CLS_D ELS_DC)
} zend_end_try();
/* shutdown_executor() takes care of its own bailout handling */
- shutdown_executor(ELS_C);
+ shutdown_executor(TSRMLS_C);
zend_try {
shutdown_compiler(CLS_C);
} zend_end_try();
zend_try {
- zend_ini_deactivate(ELS_C);
+ zend_ini_deactivate(TSRMLS_C);
} zend_end_try();
}
@@ -586,7 +588,7 @@ ZEND_API void zend_error(int type, const char *format, ...)
char *error_filename;
uint error_lineno;
zval *orig_user_error_handler;
- ELS_FETCH();
+ TSRMLS_FETCH();
CLS_FETCH();
/* Obtain relevant filename and lineno */
@@ -609,8 +611,8 @@ ZEND_API void zend_error(int type, const char *format, ...)
error_filename = zend_get_compiled_filename(CLS_C);
error_lineno = zend_get_compiled_lineno(CLS_C);
} else if (zend_is_executing()) {
- error_filename = zend_get_executed_filename(ELS_C);
- error_lineno = zend_get_executed_lineno(ELS_C);
+ error_filename = zend_get_executed_filename(TSRMLS_C);
+ error_lineno = zend_get_executed_lineno(TSRMLS_C);
} else {
error_filename = NULL;
error_lineno = 0;
@@ -740,7 +742,7 @@ ZEND_API void zend_output_debug_string(zend_bool trigger_break, char *format, ..
}
-ZEND_API int zend_execute_scripts(int type CLS_DC ELS_DC, int file_count, ...)
+ZEND_API int zend_execute_scripts(int type CLS_DC TSRMLS_DC, int file_count, ...)
{
va_list files;
int i;
@@ -756,7 +758,7 @@ ZEND_API int zend_execute_scripts(int type CLS_DC ELS_DC, int file_count, ...)
EG(active_op_array) = zend_compile_file(file_handle, ZEND_INCLUDE CLS_CC);
zend_destroy_file_handle(file_handle CLS_CC);
if (EG(active_op_array)) {
- zend_execute(EG(active_op_array) ELS_CC);
+ zend_execute(EG(active_op_array) TSRMLS_CC);
zval_ptr_dtor(EG(return_value_ptr_ptr));
EG(return_value_ptr_ptr) = &EG(global_return_value_ptr);
EG(global_return_value_ptr) = NULL;
@@ -782,14 +784,14 @@ ZEND_API char *zend_make_compiled_string_description(char *name)
int cur_lineno;
char *compiled_string_description;
CLS_FETCH();
- ELS_FETCH();
+ TSRMLS_FETCH();
if (zend_is_compiling()) {
cur_filename = zend_get_compiled_filename(CLS_C);
cur_lineno = zend_get_compiled_lineno(CLS_C);
} else if (zend_is_executing()) {
- cur_filename = zend_get_executed_filename(ELS_C);
- cur_lineno = zend_get_executed_lineno(ELS_C);
+ cur_filename = zend_get_executed_filename(TSRMLS_C);
+ cur_lineno = zend_get_executed_lineno(TSRMLS_C);
} else {
cur_filename = "Unknown";
cur_lineno = 0;
View
@@ -161,8 +161,8 @@ typedef unsigned short zend_ushort;
#include "zend_hash.h"
#include "zend_llist.h"
-#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, zval *this_ptr, int return_value_used ELS_DC
-#define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, this_ptr, return_value_used ELS_CC
+#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, zval *this_ptr, int return_value_used TSRMLS_DC
+#define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, this_ptr, return_value_used TSRMLS_CC
/*
* zval
View
@@ -40,7 +40,7 @@ ZEND_API int zend_get_parameters(int ht, int param_count, ...)
int arg_count;
va_list ptr;
zval **param, *param_ptr;
- ELS_FETCH();
+ TSRMLS_FETCH();
p = EG(argument_stack).top_element-2;
arg_count = (ulong) *p;
@@ -79,7 +79,7 @@ ZEND_API int zend_get_parameters_array(int ht, int param_count, zval **argument_
void **p;
int arg_count;
zval *param_ptr;
- ELS_FETCH();
+ TSRMLS_FETCH();
p = EG(argument_stack).top_element-2;
arg_count = (ulong) *p;
@@ -119,7 +119,7 @@ ZEND_API int zend_get_parameters_ex(int param_count, ...)
int arg_count;
va_list ptr;
zval ***param;
- ELS_FETCH();
+ TSRMLS_FETCH();
p = EG(argument_stack).top_element-2;
arg_count = (ulong) *p;
@@ -143,7 +143,7 @@ ZEND_API int zend_get_parameters_array_ex(int param_count, zval ***argument_arra
{
void **p;
int arg_count;
- ELS_FETCH();
+ TSRMLS_FETCH();
p = EG(argument_stack).top_element-2;
arg_count = (ulong) *p;
@@ -165,7 +165,7 @@ ZEND_API int ParameterPassedByReference(int ht, uint n)
void **p;
ulong arg_count;
zval *arg;
- ELS_FETCH();
+ TSRMLS_FETCH();
p = EG(argument_stack).elements+EG(argument_stack).top-2;
arg_count = (ulong) *p;
@@ -479,7 +479,7 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl
void **p;
int arg_count;
int quiet = flags & ZEND_PARSE_PARAMS_QUIET;
- ELS_FETCH();
+ TSRMLS_FETCH();
for (spec_walk = type_spec; *spec_walk; spec_walk++) {
c = *spec_walk;
@@ -1010,9 +1010,9 @@ ZEND_API int zend_startup_module(zend_module_entry *module)
if (module) {
module->module_number = zend_next_free_module();
if (module->module_startup_func) {
- ELS_FETCH();
+ TSRMLS_FETCH();
- if (module->module_startup_func(MODULE_PERSISTENT, module->module_number ELS_CC)==FAILURE) {
+ if (module->module_startup_func(MODULE_PERSISTENT, module->module_number TSRMLS_CC)==FAILURE) {
zend_error(E_CORE_ERROR,"Unable to start %s module",module->name);
return FAILURE;
}
@@ -1148,12 +1148,12 @@ void module_destructor(zend_module_entry *module)
int module_registry_request_startup(zend_module_entry *module)
{
if (module->request_startup_func) {
- ELS_FETCH();
+ TSRMLS_FETCH();
#if 0
zend_printf("%s: Request startup\n",module->name);
#endif
- if (module->request_startup_func(module->type, module->module_number ELS_CC)==FAILURE) {
+ if (module->request_startup_func(module->type, module->module_number TSRMLS_CC)==FAILURE) {
zend_error(E_WARNING, "request_startup() for %s module failed", module->name);
exit(1);
}
@@ -1305,7 +1305,7 @@ zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char **callabl
{
char *lcname;
int retval = 0;
- ELS_FETCH();
+ TSRMLS_FETCH();
switch (Z_TYPE_P(callable)) {
case IS_STRING:
View
@@ -68,7 +68,7 @@
#define ZEND_EXTERN_MODULE_GLOBALS(module_name) \
extern ts_rsrc_id module_name##_globals_id;
#define ZEND_INIT_MODULE_GLOBALS(module_name, globals_ctor, globals_dtor) \
- module_name##_globals_id = ts_allocate_id(sizeof(zend_##module_name##_globals), (ts_allocate_ctor) globals_ctor, (ts_allocate_dtor) globals_dtor);
+ ts_allocate_id(&module_name##_globals_id, sizeof(zend_##module_name##_globals), (ts_allocate_ctor) globals_ctor, (ts_allocate_dtor) globals_dtor);
#else
@@ -426,7 +426,7 @@ ZEND_FUNCTION(define)
c.flags = case_sensitive; /* non persistent */
c.name = zend_strndup((*var)->value.str.val, (*var)->value.str.len);
c.name_len = (*var)->value.str.len+1;
- if (zend_register_constant(&c ELS_CC) == SUCCESS) {
+ if (zend_register_constant(&c TSRMLS_CC) == SUCCESS) {
RETURN_TRUE;
} else {
RETURN_FALSE;
@@ -945,7 +945,7 @@ ZEND_FUNCTION(create_function)
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");
- retval = zend_eval_string(eval_code, NULL, eval_name CLS_CC ELS_CC);
+ retval = zend_eval_string(eval_code, NULL, eval_name CLS_CC TSRMLS_CC);
efree(eval_code);
efree(eval_name);
View
@@ -84,10 +84,10 @@ void zend_init_compiler_data_structures(CLS_D)
}
-void init_compiler(CLS_D ELS_DC)
+void init_compiler(CLS_D TSRMLS_DC)
{
zend_init_compiler_data_structures(CLS_C);
- zend_init_rsrc_list(ELS_C);
+ zend_init_rsrc_list(TSRMLS_C);
zend_hash_init(&CG(filenames_table), 5, NULL, (dtor_func_t) free_estring, 0);
zend_llist_init(&CG(open_files), sizeof(zend_file_handle), (void (*)(void *)) zend_file_handle_dtor, 0);
CG(unclean_shutdown) = 0;
Oops, something went wrong.

0 comments on commit 2c254ba

Please sign in to comment.