More TSRMLS_FETCH annihilation

This commit is contained in:
Zeev Suraski 2001-07-30 04:54:16 +00:00
parent 11e5d2f229
commit 8ce8324e59
19 changed files with 140 additions and 129 deletions

View 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;

View 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 */

View 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 {

View 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) {

View 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();

View 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;

View 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;

View 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);

View 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()

View 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

View 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);

View 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();
}

View 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; }
;

View 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);

View 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;

View 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) \

View 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);
}

View File

@ -36,27 +36,28 @@
#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 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);
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);
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); \
}

View 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: