]> granicus.if.org Git - php/commitdiff
More TSRMLS_FETCH annihilation
authorZeev Suraski <zeev@php.net>
Mon, 30 Jul 2001 04:54:16 +0000 (04:54 +0000)
committerZeev Suraski <zeev@php.net>
Mon, 30 Jul 2001 04:54:16 +0000 (04:54 +0000)
19 files changed:
Zend/zend_API.c
Zend/zend_API.h
Zend/zend_builtin_functions.c
Zend/zend_execute.c
Zend/zend_execute_API.c
Zend/zend_globals.h
Zend/zend_hash.c
Zend/zend_hash.h
Zend/zend_highlight.h
Zend/zend_ini_parser.y
Zend/zend_ini_scanner.h
Zend/zend_ini_scanner.l
Zend/zend_language_parser.y
Zend/zend_language_scanner.l
Zend/zend_list.c
Zend/zend_list.h
Zend/zend_operators.c
Zend/zend_operators.h
Zend/zend_variables.c

index 2de112725e4477c9590a773a890f8a3bc1dffa6a..f422fac3fdcb1ab0b0ef7e56880a01f8e3c102da 100644 (file)
@@ -466,7 +466,7 @@ static int zend_parse_arg(int arg_num, zval **arg, va_list *va, char **spec, int
        return SUCCESS;
 }
 
-static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int flags)
+static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int flags TSRMLS_DC)
 {
        char *spec_walk;
        char buf[1024];
@@ -477,7 +477,6 @@ 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;
-       TSRMLS_FETCH();
 
        for (spec_walk = type_spec; *spec_walk; spec_walk++) {
                c = *spec_walk;
@@ -548,25 +547,25 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl
        return SUCCESS;
 }
 
-ZEND_API int zend_parse_parameters_ex(int flags, int num_args, char *type_spec, ...)
+ZEND_API int zend_parse_parameters_ex(int flags TSRMLS_DC, int num_args, char *type_spec, ...)
 {
        va_list va;
        int retval;
        
        va_start(va, type_spec);
-       retval = zend_parse_va_args(num_args, type_spec, &va, flags);
+       retval = zend_parse_va_args(num_args, type_spec, &va, flags TSRMLS_CC);
        va_end(va);
 
        return retval;
 }
 
-ZEND_API int zend_parse_parameters(int num_args, char *type_spec, ...)
+ZEND_API int zend_parse_parameters(int num_args TSRMLS_DC, char *type_spec, ...)
 {
        va_list va;
        int retval;
        
        va_start(va, type_spec);
-       retval = zend_parse_va_args(num_args, type_spec, &va, 0);
+       retval = zend_parse_va_args(num_args, type_spec, &va, 0 TSRMLS_CC);
        va_end(va);
 
        return retval;
index f7039c85747ce2b1519eda755c8ace32e1155db8..de5aea9a7ce84b8ab0a0f7274843bdbf3e104d9c 100644 (file)
@@ -117,8 +117,8 @@ ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_arr
 /* Parameter parsing API -- andrei */
 
 #define ZEND_PARSE_PARAMS_QUIET 1<<1
-ZEND_API int zend_parse_parameters(int num_args, char *type_spec, ...);
-ZEND_API int zend_parse_parameters_ex(int flags, int num_args, char *type_spec, ...);
+ZEND_API int zend_parse_parameters(int num_args TSRMLS_DC, char *type_spec, ...);
+ZEND_API int zend_parse_parameters_ex(int flags TSRMLS_DC, int num_args, char *type_spec, ...);
 
 /* Parameter parsing API -- andrei */
 
index d0b2fa60c7b3f4be31fcbcc800d406f339309e67..4b13075058f424fbaa4f3471cfa261216bb7e2b7 100644 (file)
@@ -1000,7 +1000,7 @@ ZEND_FUNCTION(get_resource_type)
                RETURN_FALSE;
        }
 
-       resource_type = zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(z_resource_type));
+       resource_type = zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(z_resource_type) TSRMLS_CC);
        if (resource_type) {
                RETURN_STRING(resource_type, 1);
        } else {
index 7dc80be5d3ffd8232194ab564227b4075ff208d9..c76ccd9e2e95f4a8204dc6987cae05d589b3e504 100644 (file)
@@ -1080,7 +1080,7 @@ ZEND_API void execute(zend_op_array *op_array TSRMLS_DC)
 binary_op_addr:
                                EG(binary_op)(&Ts[opline->result.u.var].tmp_var, 
                                        get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R),
-                                       get_zval_ptr(&opline->op2, Ts, &EG(free_op2), BP_VAR_R) );
+                                       get_zval_ptr(&opline->op2, Ts, &EG(free_op2), BP_VAR_R) TSRMLS_CC);
                                FREE_OP(&opline->op1, EG(free_op1));
                                FREE_OP(&opline->op2, EG(free_op2));
                                NEXT_OPCODE();
@@ -1140,7 +1140,7 @@ binary_assign_op_addr: {
                                        
                                        SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
 
-                                       EG(binary_op)(*var_ptr, *var_ptr, get_zval_ptr(&opline->op2, Ts, &EG(free_op2), BP_VAR_R));
+                                       EG(binary_op)(*var_ptr, *var_ptr, get_zval_ptr(&opline->op2, Ts, &EG(free_op2), BP_VAR_R) TSRMLS_CC);
                                        Ts[opline->result.u.var].var.ptr_ptr = var_ptr;
                                        SELECTIVE_PZVAL_LOCK(*var_ptr, &opline->result);
                                        FREE_OP(&opline->op2, EG(free_op2));
@@ -1880,7 +1880,7 @@ send_by_ref:
                                        }
                                        is_equal_function(&Ts[opline->result.u.var].tmp_var, 
                                                                 get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R),
-                                                                get_zval_ptr(&opline->op2, Ts, &EG(free_op2), BP_VAR_R));
+                                                                get_zval_ptr(&opline->op2, Ts, &EG(free_op2), BP_VAR_R) TSRMLS_CC);
 
                                        FREE_OP(&opline->op2, EG(free_op2));
                                        if (switch_expr_is_overloaded) {
index e2bc057aabf5aa6f8c509b3ab60cdf3552947d69..523b8dd2ad3f5b11d68a3ac522f66fb0dbca9097 100644 (file)
@@ -381,7 +381,7 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun
        zend_op **original_opline_ptr;
        int orig_free_op1, orig_free_op2;
        int (*orig_unary_op)(zval *result, zval *op1);
-       int (*orig_binary_op)(zval *result, zval *op1, zval *op2);
+       int (*orig_binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC);
        zval function_name_copy;
        TSRMLS_FETCH();
 
index 1e2ee909f79d0f722da57669ada5adc8f4fb96e2..7b55b2ae2a5b6fde73ea8fd7076ef956a6ef968b 100644 (file)
@@ -36,8 +36,6 @@
 /*#undef ZTS*/
 
 #ifdef ZTS
-#include "../TSRM/TSRM.h"
-
 #ifdef __cplusplus
 class ZendFlexLexer;
 class ZendIniFlexLexer;
@@ -184,7 +182,7 @@ struct _zend_executor_globals {
        zend_ptr_stack argument_stack;
        int free_op1, free_op2;
        int (*unary_op)(zval *result, zval *op1);
-       int (*binary_op)(zval *result, zval *op1, zval *op2);
+       int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC);
 
        zval *garbage[2];
        int garbage_ptr;
index 55d6883e0f28c9378f62755fd9cc7bf268396aa4..6b6bb7e17126211a97c359f74d0613e8d6686d4f 100644 (file)
@@ -1143,7 +1143,7 @@ ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func,
 }
 
 
-ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered)
+ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC)
 {
        Bucket *p1, *p2;
        int result;
index 682b3a78a13e14ecd4feee7a7c51ee46b97498fc..c19a38c26d20c65d4830d1719c10d9d1e27c143d 100644 (file)
@@ -171,7 +171,7 @@ ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_fun
 ZEND_API void zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite);
 ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, uint size, zend_bool (*pReplaceOrig)(void *orig, void *p_new));
 ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber);
-ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered);
+ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC);
 ZEND_API int zend_hash_minmax(HashTable *ht, int (*compar)(const void *, const void *), int flag, void **pData);
 
 ZEND_API int zend_hash_num_elements(HashTable *ht);
index 5a9596d8d82c6c62722ce5929fbf7e4b75e0362b..60081a80327a71bc856931ee7be8d82cc5a5d63f 100644 (file)
@@ -40,8 +40,8 @@ typedef struct _zend_syntax_highlighter_ini {
 
 BEGIN_EXTERN_C()
 ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini);
-ZEND_API int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini);
-ZEND_API int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name);
+ZEND_API int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC);
+ZEND_API int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name TSRMLS_DC);
 ZEND_API void zend_html_putc(char c);
 ZEND_API void zend_html_puts(char *s, uint len);
 END_EXTERN_C()
index 6b4f431e3467fe8d4bb8dc43e2d0fbe8b8076fcc..7e003a7a0e0524d36400c275208c96725123927d 100644 (file)
@@ -128,7 +128,7 @@ static void ini_error(char *str)
        error_buf_len = 128+strlen(currently_parsed_filename); /* should be more than enough */
        error_buf = (char *) emalloc(error_buf_len);
 
-       sprintf(error_buf, "Error parsing %s on line %d\n", currently_parsed_filename, zend_ini_scanner_get_lineno());
+       sprintf(error_buf, "Error parsing %s on line %d\n", currently_parsed_filename, zend_ini_scanner_get_lineno(TSRMLS_C));
 
        if (CG(ini_parser_unbuffered_errors)) {
 #ifdef PHP_WIN32
index c88174bd66fb3720195cd71bfc9477371560b95a..5f2e337665ad78cb08b5ac84690652688d0a8c33 100644 (file)
@@ -14,7 +14,7 @@ public:
 #endif /* ZTS && __cplusplus */
 
 BEGIN_EXTERN_C()
-int zend_ini_scanner_get_lineno(void);
+int zend_ini_scanner_get_lineno(TSRMLS_D);
 char *zend_ini_scanner_get_filename(void);
 int zend_ini_open_file_for_scanning(zend_file_handle *fh);
 void zend_ini_close_file(zend_file_handle *fh);
index fd044823679bff389e1346e92115ef451e08f23f..f62d79a86c4b7fd4be97fd0a1d4bed629d35a0c6 100644 (file)
@@ -70,10 +70,8 @@ char *zend_ini_scanner_get_filename()
 
 #else /* ZTS */
 
-int zend_ini_scanner_get_lineno()
+int zend_ini_scanner_get_lineno(TSRMLS_D)
 {
-       TSRMLS_FETCH();
-
        return CG(ini_scanner)->lineno();
 }
 
index e3fd1fd7826c7979abce25b1b1cfce4b72c4e2c2..46cce268a828ef13107f2d9e71a337209e8f6c87 100644 (file)
@@ -139,7 +139,7 @@ start:
 ;
 
 top_statement_list:
-               top_statement_list  { zend_do_extended_info(TSRMLS_C); } top_statement { TSRMLS_FETCH(); HANDLE_INTERACTIVE(); }
+               top_statement_list  { zend_do_extended_info(TSRMLS_C); } top_statement { HANDLE_INTERACTIVE(); }
        |       /* empty */
 ;
 
@@ -151,7 +151,7 @@ top_statement:
 
 
 inner_statement_list:
-               inner_statement_list  { zend_do_extended_info(TSRMLS_C); } inner_statement { TSRMLS_FETCH(); HANDLE_INTERACTIVE(); }
+               inner_statement_list  { zend_do_extended_info(TSRMLS_C); } inner_statement { HANDLE_INTERACTIVE(); }
        |       /* empty */
 ;
 
@@ -530,7 +530,7 @@ static_scalar: /* compile-time evaluated scalars */
                common_scalar           { $$ = $1; }
        |       T_STRING                { zend_do_fetch_constant(&$$, &$1, ZEND_CT TSRMLS_CC); }
        |       '+' static_scalar       { $$ = $1; }
-       |       '-' static_scalar       { zval minus_one;  minus_one.type = IS_LONG; minus_one.value.lval = -1;  mul_function(&$2.u.constant, &$2.u.constant, &minus_one);  $$ = $2; }
+       |       '-' static_scalar       { zval minus_one;  minus_one.type = IS_LONG; minus_one.value.lval = -1;  mul_function(&$2.u.constant, &$2.u.constant, &minus_one TSRMLS_CC);  $$ = $2; }
        |       T_ARRAY '(' static_array_pair_list ')' { $$ = $3; $$.u.constant.type = IS_CONSTANT_ARRAY; }
 ;
 
index 3e124adeffd67ea82256faa247645ed72b65fbc0..259bd1a947d5b9778b061aec92278a08d8f4a094 100644 (file)
@@ -502,11 +502,10 @@ zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC)
 
 
 BEGIN_EXTERN_C()
-int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini)
+int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC)
 {
        zend_lex_state original_lex_state;
        zend_file_handle file_handle;
-       TSRMLS_FETCH();
 
        file_handle.type = ZEND_HANDLE_FILENAME;
        file_handle.filename = filename;
@@ -523,14 +522,13 @@ int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlight
        return SUCCESS;
 }
 
-int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name)
+int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name TSRMLS_DC)
 {
        zend_lex_state original_lex_state;
        zval tmp = *str;
 #ifdef ZTS
        istrstream *input_stream;
 #endif
-       TSRMLS_FETCH();
 
        str = &tmp;
        zval_copy_ctor(str);
index 5d3f53ead27b46f163d62a44d23dbb9836a43453..4cd588367fd5744b7cc7078bb1ab32289fe76aeb 100644 (file)
@@ -46,10 +46,9 @@ ZEND_API int zend_list_insert(void *ptr, int type)
        return index;
 }
 
-ZEND_API int zend_list_delete(int id)
+ZEND_API int _zend_list_delete(int id TSRMLS_DC)
 {
        zend_rsrc_list_entry *le;
-       TSRMLS_FETCH();
        
        if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
 /*             printf("del(%d): %d->%d\n", id, le->refcount, le->refcount-1); */
@@ -64,10 +63,9 @@ ZEND_API int zend_list_delete(int id)
 }
 
 
-ZEND_API void *zend_list_find(int id, int *type)
+ZEND_API void *_zend_list_find(int id, int *type TSRMLS_DC)
 {
        zend_rsrc_list_entry *le;
-       TSRMLS_FETCH();
 
        if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
                *type = le->type;
@@ -79,10 +77,9 @@ ZEND_API void *zend_list_find(int id, int *type)
 }
 
 
-ZEND_API int zend_list_addref(int id)
+ZEND_API int _zend_list_addref(int id TSRMLS_DC)
 {
        zend_rsrc_list_entry *le;
-       TSRMLS_FETCH();
        
        if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
 /*             printf("add(%d): %d->%d\n", id, le->refcount, le->refcount+1); */
@@ -109,7 +106,7 @@ ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int r
 }
 
 
-ZEND_API void *zend_fetch_resource(zval **passed_id, int default_id, char *resource_type_name, int *found_resource_type, int num_resource_types, ...)
+ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, char *resource_type_name, int *found_resource_type, int num_resource_types, ...)
 {
        int id;
        int actual_resource_type;
@@ -378,7 +375,7 @@ void zend_destroy_rsrc_list_dtors(void)
 }
 
 
-char *zend_rsrc_list_get_rsrc_type(int resource)
+char *zend_rsrc_list_get_rsrc_type(int resource TSRMLS_DC)
 {
        zend_rsrc_list_dtors_entry *lde;
        int rsrc_type;
index e612838a543b39754d04360219e13ab4e6839a53..f3b414e4daed126637ac0393bf6694b5949ec1b7 100644 (file)
@@ -74,14 +74,18 @@ int zend_init_rsrc_list_dtors(void);
 void zend_destroy_rsrc_list_dtors(void);
 
 ZEND_API int zend_list_insert(void *ptr, int type);
-ZEND_API int zend_list_addref(int id);
-ZEND_API int zend_list_delete(int id);
-ZEND_API void *zend_list_find(int id, int *type);
+ZEND_API int _zend_list_addref(int id TSRMLS_DC);
+ZEND_API int _zend_list_delete(int id TSRMLS_DC);
+ZEND_API void *_zend_list_find(int id, int *type TSRMLS_DC);
+
+#define zend_list_addref(id)           _zend_list_addref(id TSRMLS_CC)
+#define zend_list_delete(id)           _zend_list_delete(id TSRMLS_CC)
+#define zend_list_find(id, type)       _zend_list_find(id, type TSRMLS_CC)
 
 ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type);
-ZEND_API void *zend_fetch_resource(zval **passed_id, int default_id, char *resource_type_name, int *found_resource_type, int num_resource_types, ...);
+ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, char *resource_type_name, int *found_resource_type, int num_resource_types, ...);
 
-ZEND_API char *zend_rsrc_list_get_rsrc_type(int resource);
+ZEND_API char *zend_rsrc_list_get_rsrc_type(int resource TSRMLS_DC);
 ZEND_API int zend_fetch_list_dtor_id(char *type_name);
 
 extern ZEND_API int le_index_ptr;  /* list entry type for index pointers */
@@ -92,11 +96,11 @@ extern ZEND_API int le_index_ptr;  /* list entry type for index pointers */
        }
 
 #define ZEND_FETCH_RESOURCE(rsrc, rsrc_type, passed_id, default_id, resource_type_name, resource_type) \
-       rsrc = (rsrc_type) zend_fetch_resource(passed_id, default_id, resource_type_name, NULL, 1, resource_type);      \
+       rsrc = (rsrc_type) zend_fetch_resource(passed_id TSRMLS_CC, default_id, resource_type_name, NULL, 1, resource_type);    \
        ZEND_VERIFY_RESOURCE(rsrc);
 
 #define ZEND_FETCH_RESOURCE2(rsrc, rsrc_type, passed_id, default_id, resource_type_name, resource_type1,resource_type2)        \
-       rsrc = (rsrc_type) zend_fetch_resource(passed_id, default_id, resource_type_name, NULL, 2, resource_type1, resource_type2);     \
+       rsrc = (rsrc_type) zend_fetch_resource(passed_id TSRMLS_CC, default_id, resource_type_name, NULL, 2, resource_type1, resource_type2);   \
        ZEND_VERIFY_RESOURCE(rsrc);
 
 #define ZEND_REGISTER_RESOURCE(rsrc_result, rsrc_pointer, rsrc_type)  \
index 506dbe8a7d7eebbec20736cbd0e403e56d2ee1b3..b49f781e670f6d5197f53a3c1f72854292cd0b7d 100644 (file)
@@ -106,7 +106,7 @@ ZEND_API double zend_string_to_double(const char *number, zend_uint length)
 }
 
 
-ZEND_API void convert_scalar_to_number(zval *op)
+ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC)
 {
        switch (op->type) {
                case IS_STRING:
@@ -147,7 +147,7 @@ ZEND_API void convert_scalar_to_number(zval *op)
 
 #define zendi_convert_scalar_to_number(op, holder, result)                     \
        if (op==result) {                                                                                               \
-               convert_scalar_to_number(op);                                                           \
+               convert_scalar_to_number(op TSRMLS_CC);                                         \
        } else {                                                                                                                \
                switch ((op)->type) {                                                                           \
                        case IS_STRING:                                                                                 \
@@ -271,8 +271,11 @@ ZEND_API void convert_to_long_base(zval *op, int base)
                case IS_NULL:
                        op->value.lval = 0;
                        break;
-               case IS_RESOURCE:
-                       zend_list_delete(op->value.lval);
+               case IS_RESOURCE: {
+                               TSRMLS_FETCH();
+
+                               zend_list_delete(op->value.lval);
+                       }
                        /* break missing intentionally */
                case IS_BOOL:
                case IS_LONG:
@@ -315,8 +318,11 @@ ZEND_API void convert_to_double(zval *op)
                case IS_NULL:
                        op->value.dval = 0.0;
                        break;
-               case IS_RESOURCE:
-                       zend_list_delete(op->value.lval);
+               case IS_RESOURCE: {
+                               TSRMLS_FETCH();
+
+                               zend_list_delete(op->value.lval);
+                       }
                        /* break missing intentionally */
                case IS_BOOL:
                case IS_LONG:
@@ -368,8 +374,11 @@ ZEND_API void convert_to_boolean(zval *op)
                case IS_NULL:
                        op->value.lval = 0;
                        break;
-               case IS_RESOURCE:
-                       zend_list_delete(op->value.lval);
+               case IS_RESOURCE: {
+                               TSRMLS_FETCH();
+
+                               zend_list_delete(op->value.lval);
+                       }
                        /* break missing intentionally */
                case IS_LONG:
                        op->value.lval = (op->value.lval ? 1 : 0);
@@ -591,7 +600,7 @@ ZEND_API void multi_convert_to_string_ex(int argc, ...)
        va_end(ap);
 }
 
-ZEND_API int add_function(zval *result, zval *op1, zval *op2)
+ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
 {
        zval op1_copy, op2_copy;
 
@@ -643,7 +652,7 @@ ZEND_API int add_function(zval *result, zval *op1, zval *op2)
 }
 
 
-ZEND_API int sub_function(zval *result, zval *op1, zval *op2)
+ZEND_API int sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
 {
        zval op1_copy, op2_copy;
        
@@ -680,7 +689,7 @@ ZEND_API int sub_function(zval *result, zval *op1, zval *op2)
 }
 
 
-ZEND_API int mul_function(zval *result, zval *op1, zval *op2)
+ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
 {
        zval op1_copy, op2_copy;
        
@@ -716,7 +725,7 @@ ZEND_API int mul_function(zval *result, zval *op1, zval *op2)
        return FAILURE;                         /* unknown datatype */
 }
 
-ZEND_API int div_function(zval *result, zval *op1, zval *op2)
+ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
 {
        zval op1_copy, op2_copy;
        
@@ -756,7 +765,7 @@ ZEND_API int div_function(zval *result, zval *op1, zval *op2)
 }
 
 
-ZEND_API int mod_function(zval *result, zval *op1, zval *op2)
+ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
 {
        zval op1_copy, op2_copy;
        
@@ -775,7 +784,7 @@ ZEND_API int mod_function(zval *result, zval *op1, zval *op2)
 
 
 
-ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2)
+ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
 {
        zval op1_copy, op2_copy;
        
@@ -788,7 +797,7 @@ ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2)
 }
 
 
-ZEND_API int boolean_not_function(zval *result, zval *op1)
+ZEND_API int boolean_not_function(zval *result, zval *op1 TSRMLS_DC)
 {
        zval op1_copy;
        
@@ -800,7 +809,7 @@ ZEND_API int boolean_not_function(zval *result, zval *op1)
 }
 
 
-ZEND_API int bitwise_not_function(zval *result, zval *op1)
+ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC)
 {
        zval op1_copy = *op1;
        
@@ -831,7 +840,7 @@ ZEND_API int bitwise_not_function(zval *result, zval *op1)
 }
 
 
-ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2)
+ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
 {
        zval op1_copy, op2_copy;
        
@@ -870,7 +879,7 @@ ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2)
 }
 
 
-ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2)
+ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
 {
        zval op1_copy, op2_copy;
        
@@ -911,7 +920,7 @@ ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2)
 }
 
 
-ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2)
+ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
 {
        zval op1_copy, op2_copy;
        
@@ -951,7 +960,7 @@ ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2)
 }
 
 
-ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2)
+ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
 {
        zval op1_copy, op2_copy;
        
@@ -963,7 +972,7 @@ ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2)
 }
 
 
-ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2)
+ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
 {
        zval op1_copy, op2_copy;
        
@@ -1001,7 +1010,7 @@ ZEND_API int add_string_to_string(zval *result, zval *op1, zval *op2)
 }
 
 
-ZEND_API int concat_function(zval *result, zval *op1, zval *op2)
+ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
 {
        zval op1_copy, op2_copy;
        int use_copy1, use_copy2;
@@ -1046,7 +1055,7 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2)
 }
 
 
-ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2)
+ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
 {
        zval op1_copy, op2_copy;
        int use_copy1, use_copy2;
@@ -1073,7 +1082,7 @@ ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2)
        return SUCCESS;
 }
 
-ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2)
+ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
 {
        zval op1_copy, op2_copy;
 
@@ -1093,7 +1102,7 @@ ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2)
 }
 
 
-ZEND_API int compare_function(zval *result, zval *op1, zval *op2)
+ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
 {
        zval op1_copy, op2_copy;
 
@@ -1140,12 +1149,12 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2)
                return SUCCESS;
        }
        if (op1->type==IS_ARRAY && op2->type==IS_ARRAY) {
-               zend_compare_arrays(result, op1, op2);
+               zend_compare_arrays(result, op1, op2 TSRMLS_CC);
                return SUCCESS;
        }
 
        if (op1->type==IS_OBJECT && op2->type==IS_OBJECT) {
-               zend_compare_objects(result, op1, op2);
+               zend_compare_objects(result, op1, op2 TSRMLS_CC);
                return SUCCESS;
        }
 
@@ -1178,20 +1187,21 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2)
 static int hash_zval_identical_function(const zval **z1, const zval **z2)
 {
        zval result;
+       TSRMLS_FETCH();
 
        /* is_identical_function() returns 1 in case of identity and 0 in case
         * of a difference;
         * whereas this comparison function is expected to return 0 on identity,
         * and non zero otherwise.
         */
-       if (is_identical_function(&result, (zval *) *z1, (zval *) *z2)==FAILURE) {
+       if (is_identical_function(&result, (zval *) *z1, (zval *) *z2 TSRMLS_CC)==FAILURE) {
                return 1;
        }
        return !result.value.lval;
 }
 
 
-ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2)
+ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
 {
        result->type = IS_BOOL;
        if (op1->type != op2->type) {
@@ -1219,7 +1229,7 @@ ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2)
                        }
                        break;
                case IS_ARRAY:
-                       if (zend_hash_compare(op1->value.ht, op2->value.ht, (compare_func_t) hash_zval_identical_function, 1)==0) {
+                       if (zend_hash_compare(op1->value.ht, op2->value.ht, (compare_func_t) hash_zval_identical_function, 1 TSRMLS_CC)==0) {
                                result->value.lval = 1;
                        } else {
                                result->value.lval = 0;
@@ -1230,7 +1240,7 @@ ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2)
                        if (Z_OBJCE_P(op1) != Z_OBJCE_P(op2)) {
                                result->value.lval = 0;
                        } else {
-                               if (zend_hash_compare(Z_OBJPROP_P(op1), Z_OBJPROP_P(op2), (compare_func_t) hash_zval_identical_function, 1)==0) {
+                               if (zend_hash_compare(Z_OBJPROP_P(op1), Z_OBJPROP_P(op2), (compare_func_t) hash_zval_identical_function, 1 TSRMLS_CC)==0) {
                                        result->value.lval = 1;
                                } else {
                                        result->value.lval = 0;
@@ -1245,10 +1255,10 @@ ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2)
 }
 
 
-ZEND_API int is_not_identical_function(zval *result, zval *op1, zval *op2)
+ZEND_API int is_not_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
 {
    result->type = IS_BOOL;
-   if (is_identical_function( result, op1, op2 ) == FAILURE) {
+   if (is_identical_function(result, op1, op2 TSRMLS_CC) == FAILURE) {
          return FAILURE;
    }
    result->value.lval = !result->value.lval;
@@ -1256,9 +1266,9 @@ ZEND_API int is_not_identical_function(zval *result, zval *op1, zval *op2)
 }
 
 
-ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2)
+ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
 {
-       if (compare_function(result, op1, op2) == FAILURE) {
+       if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) {
                return FAILURE;
        }
        convert_to_boolean(result);
@@ -1271,9 +1281,9 @@ ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2)
 }
 
 
-ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2)
+ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
 {
-       if (compare_function(result, op1, op2) == FAILURE) {
+       if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) {
                return FAILURE;
        }
        convert_to_boolean(result);
@@ -1286,9 +1296,9 @@ ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2)
 }
 
 
-ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2)
+ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
 {
-       if (compare_function(result, op1, op2) == FAILURE) {
+       if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) {
                return FAILURE;
        }
        if (result->type == IS_LONG) {
@@ -1314,9 +1324,9 @@ ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2)
 }
 
 
-ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2)
+ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
 {
-       if (compare_function(result, op1, op2) == FAILURE) {
+       if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) {
                return FAILURE;
        }
        if (result->type == IS_LONG) {
@@ -1654,11 +1664,11 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2)
 }
 
 
-static int hash_zval_compare_function(const zval **z1, const zval **z2)
+static int hash_zval_compare_function(const zval **z1, const zval **z2 TSRMLS_DC)
 {
        zval result;
 
-       if (compare_function(&result, (zval *) *z1, (zval *) *z2)==FAILURE) {
+       if (compare_function(&result, (zval *) *z1, (zval *) *z2 TSRMLS_CC)==FAILURE) {
                return 1;
        }
        return result.value.lval;
@@ -1666,20 +1676,20 @@ static int hash_zval_compare_function(const zval **z1, const zval **z2)
 
 
 
-ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2)
+ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC)
 {
        result->type = IS_LONG;
-       result->value.lval = zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0);
+       result->value.lval = zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC);
 }
 
 
-ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2)
+ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC)
 {
-       zend_compare_symbol_tables(result, a1->value.ht, a2->value.ht);
+       zend_compare_symbol_tables(result, a1->value.ht, a2->value.ht TSRMLS_CC);
 }
 
 
-ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2)
+ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC)
 {
 /* OBJECTS_FIXME */
        if (Z_OBJCE_P(o1) != Z_OBJCE_P(o2)) {
@@ -1687,7 +1697,7 @@ ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2)
                result->type = IS_LONG;
                return;
        }
-       zend_compare_symbol_tables(result, Z_OBJPROP_P(o1), Z_OBJPROP_P(o2));
+       zend_compare_symbol_tables(result, Z_OBJPROP_P(o1), Z_OBJPROP_P(o2) TSRMLS_CC);
 }
 
 
index 6875dd48d27934f542515ae74505f84587771d47..6df74c790c65b2aba0164fe8c6df855cd9ea42de 100644 (file)
 #define MAX_LENGTH_OF_LONG 18
 #define MAX_LENGTH_OF_DOUBLE 32
 
-ZEND_API int add_function(zval *result, zval *op1, zval *op2);
-ZEND_API int sub_function(zval *result, zval *op1, zval *op2);
-ZEND_API int mul_function(zval *result, zval *op1, zval *op2);
-ZEND_API int div_function(zval *result, zval *op1, zval *op2);
-ZEND_API int mod_function(zval *result, zval *op1, zval *op2);
-ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2);
-ZEND_API int boolean_not_function(zval *result, zval *op1);
-ZEND_API int bitwise_not_function(zval *result, zval *op1);
-ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2);
-ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2);
-ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2);
-ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2);
-ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2);
-ZEND_API int concat_function(zval *result, zval *op1, zval *op2);
-
-ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2);
-ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2);
-ZEND_API int is_not_identical_function(zval *result, zval *op1, zval *op2);
-ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2);
-ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2);
-ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2);
+ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
+ZEND_API int sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
+ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
+ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
+ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
+ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
+ZEND_API int boolean_not_function(zval *result, zval *op1 TSRMLS_DC);
+ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC);
+ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
+ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
+ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
+ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
+ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
+ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
+
+ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
+ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
+ZEND_API int is_not_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
+ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
+ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
+ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
+
 static inline int is_numeric_string(char *str, int length, long *lval, double *dval)
 {
        long local_lval;
@@ -127,7 +128,7 @@ ZEND_API int increment_function(zval *op1);
 ZEND_API int decrement_function(zval *op2);
 
 BEGIN_EXTERN_C()
-ZEND_API void convert_scalar_to_number(zval *op);
+ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC);
 ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC);
 ZEND_API void convert_to_long(zval *op);
 ZEND_API void convert_to_double(zval *op);
@@ -147,9 +148,9 @@ ZEND_API double zend_string_to_double(const char *number, zend_uint length);
 END_EXTERN_C()
 
 ZEND_API int zval_is_true(zval *op);
-ZEND_API int compare_function(zval *result, zval *op1, zval *op2);
-ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2);
-ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2);
+ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
+ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
+ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
 
 ZEND_API void zend_str_tolower(char *str, unsigned int length);
 ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2);
@@ -162,9 +163,9 @@ ZEND_API int zend_binary_strcasecmp(char *s1, uint len1, char *s2, uint len2);
 ZEND_API int zend_binary_strncasecmp(char *s1, uint len1, char *s2, uint len2, uint length);
 
 ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2);
-ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2);
-ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2);
-ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2);
+ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC);
+ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC);
+ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC);
 
 ZEND_API int zend_atoi(const char *str, int str_len);
 
@@ -205,7 +206,7 @@ ZEND_API int zend_atoi(const char *str, int str_len);
                if (!(*ppzv)->is_ref) {                                                                         \
                        SEPARATE_ZVAL(ppzv);                                                                    \
                }                                                                                                                       \
-               convert_scalar_to_number(*ppzv);                                                        \
+               convert_scalar_to_number(*ppzv TSRMLS_CC);                                      \
        }
 
 
index 64807fd8409272c2614c20cd311603db90e2170a..5cb2ab5d6056ca6b9fcbb1e95d78739ce22c5229 100644 (file)
@@ -57,9 +57,12 @@ ZEND_API void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC)
                        zend_hash_destroy(zvalue->value.obj.properties);
                        FREE_HASHTABLE(zvalue->value.obj.properties);
                        break;
-               case IS_RESOURCE:
-                       /* destroy resource */
-                       zend_list_delete(zvalue->value.lval);
+               case IS_RESOURCE:       {
+                               TSRMLS_FETCH();
+
+                               /* destroy resource */
+                               zend_list_delete(zvalue->value.lval);
+                       }
                        break;
                case IS_LONG:
                case IS_DOUBLE:
@@ -81,8 +84,11 @@ ZEND_API void zval_add_ref(zval **p)
 ZEND_API int _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC)
 {
        switch (zvalue->type) {
-               case IS_RESOURCE:
-                       zend_list_addref(zvalue->value.lval);
+               case IS_RESOURCE: {
+                               TSRMLS_FETCH();
+
+                               zend_list_addref(zvalue->value.lval);
+                       }
                        break;
                case IS_BOOL:
                case IS_LONG: