Skip to content

Commit d76cf1d

Browse files
committed
More TSRMLS_FETCH work
1 parent 7bc71f4 commit d76cf1d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+261
-283
lines changed

Zend/zend.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
431431
}
432432

433433

434-
void zend_shutdown()
434+
void zend_shutdown(TSRMLS_D)
435435
{
436436
#ifdef ZEND_WIN32
437437
zend_shutdown_timeout_thread();
@@ -445,7 +445,7 @@ void zend_shutdown()
445445
free(GLOBAL_FUNCTION_TABLE);
446446
zend_hash_destroy(GLOBAL_CLASS_TABLE);
447447
free(GLOBAL_CLASS_TABLE);
448-
zend_shutdown_extensions();
448+
zend_shutdown_extensions(TSRMLS_C);
449449
free(zend_version_info);
450450
#ifndef ZTS
451451
zend_shutdown_constants();
@@ -520,17 +520,17 @@ void zend_activate(TSRMLS_D)
520520
}
521521

522522

523-
void zend_activate_modules(void)
523+
void zend_activate_modules(TSRMLS_D)
524524
{
525-
zend_hash_apply(&module_registry, (apply_func_t) module_registry_request_startup);
525+
zend_hash_apply(&module_registry, (apply_func_t) module_registry_request_startup TSRMLS_CC);
526526
}
527527

528528
void zend_deactivate_modules(TSRMLS_D)
529529
{
530530
EG(opline_ptr) = NULL; /* we're no longer executing anything */
531531

532532
zend_try {
533-
zend_hash_apply(&module_registry, (apply_func_t) module_registry_cleanup);
533+
zend_hash_apply(&module_registry, (apply_func_t) module_registry_cleanup TSRMLS_CC);
534534
} zend_end_try();
535535
}
536536

Zend/zend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ typedef int (*zend_write_func_t)(const char *str, uint str_length);
304304
#define BYREF_FORCE_REST 3
305305

306306
int zend_startup(zend_utility_functions *utility_functions, char **extensions, int start_builtin_functions);
307-
void zend_shutdown(void);
307+
void zend_shutdown(TSRMLS_D);
308308

309309
void zend_set_utility_values(zend_utility_values *utility_values);
310310

Zend/zend_API.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -569,9 +569,10 @@ ZEND_API int _array_init(zval *arg ZEND_FILE_LINE_DC)
569569
ZEND_API int _object_init_ex(zval *arg, zend_class_entry *class_type ZEND_FILE_LINE_DC)
570570
{
571571
zval *tmp;
572+
TSRMLS_FETCH();
572573

573574
if (!class_type->constants_updated) {
574-
zend_hash_apply_with_argument(&class_type->default_properties, (int (*)(void *,void *)) zval_update_constant, (void *) 1);
575+
zend_hash_apply_with_argument(&class_type->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
575576
class_type->constants_updated = 1;
576577
}
577578

@@ -1100,7 +1101,7 @@ void module_destructor(zend_module_entry *module)
11001101
TSRMLS_FETCH();
11011102

11021103
if (module->type == MODULE_TEMPORARY) {
1103-
zend_clean_module_rsrc_dtors(module->module_number);
1104+
zend_clean_module_rsrc_dtors(module->module_number TSRMLS_CC);
11041105
clean_module_constants(module->module_number TSRMLS_CC);
11051106
if (module->request_shutdown_func)
11061107
module->request_shutdown_func(module->type, module->module_number TSRMLS_CC);
@@ -1126,11 +1127,9 @@ void module_destructor(zend_module_entry *module)
11261127

11271128

11281129
/* call request startup for all modules */
1129-
int module_registry_request_startup(zend_module_entry *module)
1130+
int module_registry_request_startup(zend_module_entry *module TSRMLS_DC)
11301131
{
11311132
if (module->request_startup_func) {
1132-
TSRMLS_FETCH();
1133-
11341133
#if 0
11351134
zend_printf("%s: Request startup\n",module->name);
11361135
#endif
@@ -1146,10 +1145,8 @@ int module_registry_request_startup(zend_module_entry *module)
11461145
/* for persistent modules - call request shutdown and flag NOT to erase
11471146
* for temporary modules - do nothing, and flag to erase
11481147
*/
1149-
int module_registry_cleanup(zend_module_entry *module)
1148+
int module_registry_cleanup(zend_module_entry *module TSRMLS_DC)
11501149
{
1151-
TSRMLS_FETCH();
1152-
11531150
switch(module->type) {
11541151
case MODULE_PERSISTENT:
11551152
if (module->request_shutdown_func) {
@@ -1271,10 +1268,8 @@ static zend_function_entry disabled_function[] = {
12711268
};
12721269

12731270

1274-
ZEND_API int zend_disable_function(char *function_name, uint function_name_length)
1271+
ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC)
12751272
{
1276-
TSRMLS_FETCH();
1277-
12781273
if (zend_hash_del(CG(function_table), function_name, function_name_length+1)==FAILURE) {
12791274
return FAILURE;
12801275
}

Zend/zend_API.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *class_
130130
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);
131131

132132
ZEND_API zend_module_entry *zend_get_module(int module_number);
133-
ZEND_API int zend_disable_function(char *function_name, uint function_name_length);
133+
ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC);
134134

135135
ZEND_API void zend_wrong_param_count(TSRMLS_D);
136136
ZEND_API zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char **callable_name);

Zend/zend_builtin_functions.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ ZEND_FUNCTION(get_class_vars)
553553
efree(lcname);
554554
array_init(return_value);
555555
if (!ce->constants_updated) {
556-
zend_hash_apply_with_argument(&ce->default_properties, (int (*)(void *,void *)) zval_update_constant, (void *) 1);
556+
zend_hash_apply_with_argument(&ce->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
557557
ce->constants_updated = 1;
558558
}
559559
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)
10081008
}
10091009

10101010

1011-
static int add_extension_info(zend_module_entry *module, void *arg)
1011+
static int add_extension_info(zend_module_entry *module, void *arg TSRMLS_DC)
10121012
{
10131013
zval *name_array = (zval *)arg;
10141014
add_next_index_string(name_array, module->name, 1);
10151015
return 0;
10161016
}
10171017

1018-
static int add_constant_info(zend_constant *constant, void *arg)
1018+
static int add_constant_info(zend_constant *constant, void *arg TSRMLS_DC)
10191019
{
10201020
zval *name_array = (zval *)arg;
10211021
zval *const_val;
@@ -1037,7 +1037,7 @@ ZEND_FUNCTION(get_loaded_extensions)
10371037
}
10381038

10391039
array_init(return_value);
1040-
zend_hash_apply_with_argument(&module_registry, (int (*)(void *, void*)) add_extension_info, return_value);
1040+
zend_hash_apply_with_argument(&module_registry, (apply_func_arg_t) add_extension_info, return_value TSRMLS_CC);
10411041
}
10421042
/* }}} */
10431043

@@ -1051,7 +1051,7 @@ ZEND_FUNCTION(get_defined_constants)
10511051
}
10521052

10531053
array_init(return_value);
1054-
zend_hash_apply_with_argument(EG(zend_constants), (int (*)(void *, void*)) add_constant_info, return_value);
1054+
zend_hash_apply_with_argument(EG(zend_constants), (apply_func_arg_t) add_constant_info, return_value TSRMLS_CC);
10551055
}
10561056

10571057

Zend/zend_compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ void zend_do_end_function_declaration(znode *function_token TSRMLS_DC)
766766
{
767767
zend_do_extended_info(TSRMLS_C);
768768
zend_do_return(NULL, 0 TSRMLS_CC);
769-
pass_two(CG(active_op_array));
769+
pass_two(CG(active_op_array) TSRMLS_CC);
770770
CG(active_op_array) = function_token->u.op_array;
771771

772772
/* Pop the switch and foreach seperators */

Zend/zend_compile.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ extern ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handl
204204

205205
void zend_activate(TSRMLS_D);
206206
void zend_deactivate(TSRMLS_D);
207-
void zend_activate_modules(void);
207+
void zend_activate_modules(TSRMLS_D);
208208
void zend_deactivate_modules(TSRMLS_D);
209209

210210

@@ -383,9 +383,9 @@ void zend_class_add_ref(zend_class_entry *ce);
383383
zend_op *get_next_op(zend_op_array *op_array TSRMLS_DC);
384384
void init_op(zend_op *op TSRMLS_DC);
385385
int get_next_op_number(zend_op_array *op_array);
386-
int print_class(zend_class_entry *class_entry);
386+
int print_class(zend_class_entry *class_entry TSRMLS_DC);
387387
void print_op_array(zend_op_array *op_array, int optimizations);
388-
int pass_two(zend_op_array *op_array);
388+
int pass_two(zend_op_array *op_array TSRMLS_DC);
389389
zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array);
390390
ZEND_API zend_bool zend_is_compiling(TSRMLS_D);
391391
ZEND_API char *zend_make_compiled_string_description(char *name TSRMLS_DC);

Zend/zend_constants.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void zend_copy_constants(HashTable *target, HashTable *source)
5151
}
5252

5353

54-
static int clean_non_persistent_constant(zend_constant *c)
54+
static int clean_non_persistent_constant(zend_constant *c TSRMLS_DC)
5555
{
5656
if (c->flags & CONST_PERSISTENT) {
5757
return 0;
@@ -61,7 +61,7 @@ static int clean_non_persistent_constant(zend_constant *c)
6161
}
6262

6363

64-
static int clean_module_constant(zend_constant *c, int *module_number)
64+
static int clean_module_constant(zend_constant *c, int *module_number TSRMLS_DC)
6565
{
6666
if (c->module_number == *module_number) {
6767
return 1;
@@ -73,7 +73,7 @@ static int clean_module_constant(zend_constant *c, int *module_number)
7373

7474
void clean_module_constants(int module_number TSRMLS_DC)
7575
{
76-
zend_hash_apply_with_argument(EG(zend_constants), (int (*)(void *,void *)) clean_module_constant, (void *) &module_number);
76+
zend_hash_apply_with_argument(EG(zend_constants), (apply_func_arg_t) clean_module_constant, (void *) &module_number TSRMLS_CC);
7777
}
7878

7979

@@ -156,7 +156,7 @@ int zend_shutdown_constants(TSRMLS_D)
156156

157157
void clean_non_persistent_constants(TSRMLS_D)
158158
{
159-
zend_hash_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant);
159+
zend_hash_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant TSRMLS_CC);
160160
}
161161

162162

Zend/zend_execute.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ static void zend_fetch_var_address(znode *result, znode *op1, znode *op2, temp_v
6161
static void zend_fetch_dimension_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC);
6262
static void zend_fetch_property_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type TSRMLS_DC);
6363
static void zend_fetch_dimension_address_from_tmp_var(znode *result, znode *op1, znode *op2, temp_variable *Ts TSRMLS_DC);
64-
static void zend_extension_statement_handler(zend_extension *extension, zend_op_array *op_array);
65-
static void zend_extension_fcall_begin_handler(zend_extension *extension, zend_op_array *op_array);
66-
static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_array *op_array);
64+
static void zend_extension_statement_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC);
65+
static void zend_extension_fcall_begin_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC);
66+
static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC);
6767

6868
#define RETURN_VALUE_USED(opline) (!((opline)->result.u.EA.type & EXT_TYPE_UNUSED))
6969

@@ -473,23 +473,23 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
473473

474474

475475
/* Utility Functions for Extensions */
476-
static void zend_extension_statement_handler(zend_extension *extension, zend_op_array *op_array)
476+
static void zend_extension_statement_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
477477
{
478478
if (extension->statement_handler) {
479479
extension->statement_handler(op_array);
480480
}
481481
}
482482

483483

484-
static void zend_extension_fcall_begin_handler(zend_extension *extension, zend_op_array *op_array)
484+
static void zend_extension_fcall_begin_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
485485
{
486486
if (extension->fcall_begin_handler) {
487487
extension->fcall_begin_handler(op_array);
488488
}
489489
}
490490

491491

492-
static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_array *op_array)
492+
static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
493493
{
494494
if (extension->fcall_end_handler) {
495495
extension->fcall_end_handler(op_array);
@@ -561,7 +561,7 @@ static void zend_fetch_var_address(znode *result, znode *op1, znode *op2, temp_v
561561
if (op2->u.fetch_type == ZEND_FETCH_LOCAL) {
562562
FREE_OP(op1, free_op1);
563563
} else if (op2->u.fetch_type == ZEND_FETCH_STATIC) {
564-
zval_update_constant(retval, (void *) 1);
564+
zval_update_constant(retval, (void *) 1 TSRMLS_CC);
565565
}
566566

567567
if (varname == &tmp_varname) {
@@ -937,19 +937,19 @@ static void call_overloaded_function(temp_variable *T, int arg_count, zval *retu
937937
#if ZEND_INTENSIVE_DEBUGGING
938938

939939
#define CHECK_SYMBOL_TABLES() \
940-
zend_hash_apply(&EG(symbol_table), (apply_func_t) zend_check_symbol); \
940+
zend_hash_apply(&EG(symbol_table), (apply_func_t) zend_check_symbol TSRMLS_CC); \
941941
if (&EG(symbol_table)!=EG(active_symbol_table)) { \
942-
zend_hash_apply(EG(active_symbol_table), (apply_func_t) zend_check_symbol); \
942+
zend_hash_apply(EG(active_symbol_table), (apply_func_t) zend_check_symbol TSRMLS_CC); \
943943
}
944944

945-
static int zend_check_symbol(zval **pz)
945+
static int zend_check_symbol(zval **pz TSRMLS_DC)
946946
{
947947
if ((*pz)->type>9) {
948948
fprintf(stderr, "Warning! %x has invalid type!\n", *pz);
949949
} else if ((*pz)->type==IS_ARRAY) {
950-
zend_hash_apply((*pz)->value.ht, (apply_func_t) zend_check_symbol);
950+
zend_hash_apply((*pz)->value.ht, (apply_func_t) zend_check_symbol TSRMLS_CC);
951951
} else if ((*pz)->type==IS_OBJECT) {
952-
zend_hash_apply((*pz)->value.obj.properties, (apply_func_t) zend_check_symbol);
952+
zend_hash_apply((*pz)->value.obj.properties, (apply_func_t) zend_check_symbol TSRMLS_CC);
953953
}
954954

955955
return 0;
@@ -1793,7 +1793,7 @@ binary_assign_op_addr: {
17931793
zval_copy_ctor(default_value);
17941794
}
17951795
default_value->refcount=1;
1796-
zval_update_constant(&default_value, 0);
1796+
zval_update_constant(&default_value, 0 TSRMLS_CC);
17971797
default_value->refcount=0;
17981798
default_value->is_ref=0;
17991799
param = &default_value;
@@ -2375,17 +2375,17 @@ binary_assign_op_addr: {
23752375
NEXT_OPCODE();
23762376
case ZEND_EXT_STMT:
23772377
if (!EG(no_extensions)) {
2378-
zend_llist_apply_with_argument(&zend_extensions, (void (*)(void *, void *)) zend_extension_statement_handler, op_array);
2378+
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_statement_handler, op_array TSRMLS_CC);
23792379
}
23802380
NEXT_OPCODE();
23812381
case ZEND_EXT_FCALL_BEGIN:
23822382
if (!EG(no_extensions)) {
2383-
zend_llist_apply_with_argument(&zend_extensions, (void (*)(void *, void *)) zend_extension_fcall_begin_handler, op_array);
2383+
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_begin_handler, op_array TSRMLS_CC);
23842384
}
23852385
NEXT_OPCODE();
23862386
case ZEND_EXT_FCALL_END:
23872387
if (!EG(no_extensions)) {
2388-
zend_llist_apply_with_argument(&zend_extensions, (void (*)(void *, void *)) zend_extension_fcall_end_handler, op_array);
2388+
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_end_handler, op_array TSRMLS_CC);
23892389
}
23902390
NEXT_OPCODE();
23912391
case ZEND_DECLARE_FUNCTION_OR_CLASS:

Zend/zend_execute.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static inline int i_zend_is_true(zval *op)
101101
return result;
102102
}
103103

104-
ZEND_API int zval_update_constant(zval **pp, void *arg);
104+
ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC);
105105

106106
/* dedicated Zend executor functions - do not use! */
107107
static inline void zend_ptr_stack_clear_multiple(TSRMLS_D)

0 commit comments

Comments
 (0)