diff options
Diffstat (limited to 'Zend/zend_API.c')
| -rw-r--r-- | Zend/zend_API.c | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index b5d8e5310d..719b6a8828 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -55,7 +55,7 @@ ZEND_API int zend_get_parameters(int ht, int param_count, ...) /* {{{ */ while (param_count-->0) { param = va_arg(ptr, zval **); param_ptr = *(p-arg_count); - if (!PZVAL_IS_REF(param_ptr) && param_ptr->refcount>1) { + if (!PZVAL_IS_REF(param_ptr) && Z_REFCOUNT_P(param_ptr) > 1) { zval *new_tmp; ALLOC_ZVAL(new_tmp); @@ -63,7 +63,7 @@ ZEND_API int zend_get_parameters(int ht, int param_count, ...) /* {{{ */ zval_copy_ctor(new_tmp); INIT_PZVAL(new_tmp); param_ptr = new_tmp; - ((zval *) *(p-arg_count))->refcount--; + Z_DELREF_P((zval *) *(p-arg_count)); *(p-arg_count) = param_ptr; } *param = param_ptr; @@ -90,7 +90,7 @@ ZEND_API int _zend_get_parameters_array(int ht, int param_count, zval **argument while (param_count-->0) { param_ptr = *(p-arg_count); - if (!PZVAL_IS_REF(param_ptr) && param_ptr->refcount>1) { + if (!PZVAL_IS_REF(param_ptr) && Z_REFCOUNT_P(param_ptr) > 1) { zval *new_tmp; ALLOC_ZVAL(new_tmp); @@ -98,7 +98,7 @@ ZEND_API int _zend_get_parameters_array(int ht, int param_count, zval **argument zval_copy_ctor(new_tmp); INIT_PZVAL(new_tmp); param_ptr = new_tmp; - ((zval *) *(p-arg_count))->refcount--; + Z_DELREF_P((zval *) *(p-arg_count)); *(p-arg_count) = param_ptr; } *(argument_array++) = param_ptr; @@ -291,7 +291,7 @@ static int parse_arg_object_to_string(zval **arg, char **p, int *pl, int type TS if (!Z_OBJ_HANDLER_PP(arg, cast_object) && Z_OBJ_HANDLER_PP(arg, get)) { int use_copy; zval *z = Z_OBJ_HANDLER_PP(arg, get)(*arg TSRMLS_CC); - z->refcount++; + Z_ADDREF_P(z); if(Z_TYPE_P(z) != IS_OBJECT) { zval_dtor(*arg); Z_TYPE_P(*arg) = IS_NULL; @@ -1269,13 +1269,13 @@ ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC utype = IS_STRING; break; } - if ((*p)->is_ref && + if (Z_ISREF_PP(p) && class_type->parent && zend_u_hash_find(&class_type->parent->default_static_members, utype, str_index, str_length, (void**)&q) == SUCCESS && *p == *q && zend_u_hash_find(CE_STATIC_MEMBERS(class_type->parent), utype, str_index, str_length, (void**)&q) == SUCCESS) { - (*q)->refcount++; - (*q)->is_ref = 1; + Z_ADDREF_PP(q); + Z_SET_ISREF_PP(q); zend_u_hash_add(CE_STATIC_MEMBERS(class_type), utype, str_index, str_length, (void**)q, sizeof(zval*), NULL); } else { zval *q; @@ -2548,7 +2548,7 @@ ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length, zen if (num_symbol_tables <= 0) return FAILURE; - symbol->is_ref = is_ref; + Z_SET_ISREF_TO_P(symbol, is_ref); va_start(symbol_table_list, num_symbol_tables); while (num_symbol_tables-- > 0) { @@ -3069,7 +3069,7 @@ ZEND_API int zend_fcall_info_args(zend_fcall_info *fci, zval *args TSRMLS_DC) /* zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(args), &pos); while (zend_hash_get_current_data_ex(Z_ARRVAL_P(args), (void *) &arg, &pos) == SUCCESS) { *params++ = arg; - ZVAL_ADDREF(*arg); + Z_ADDREF_P(*arg); zend_hash_move_forward_ex(Z_ARRVAL_P(args), &pos); } @@ -3092,7 +3092,7 @@ ZEND_API int zend_fcall_info_argp(zend_fcall_info *fci TSRMLS_DC, int argc, zval fci->params = (zval ***) erealloc(fci->params, fci->param_count * sizeof(zval **)); for (i = 0; i < argc; ++i) { - ZVAL_ADDREF(*(argv[i])); + Z_ADDREF_P(*(argv[i])); fci->params[i] = argv[i]; } } @@ -3118,7 +3118,7 @@ ZEND_API int zend_fcall_info_argv(zend_fcall_info *fci TSRMLS_DC, int argc, va_l for (i = 0; i < argc; ++i) { arg = va_arg(*argv, zval **); - ZVAL_ADDREF(*arg); + Z_ADDREF_P(*arg); fci->params[i] = arg; } } @@ -3525,8 +3525,8 @@ ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, c zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_NULL(tmp); zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC); } @@ -3537,8 +3537,8 @@ ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, c zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_BOOL(tmp, value); zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC); } @@ -3549,8 +3549,8 @@ ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, c zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_LONG(tmp, value); zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC); } @@ -3561,8 +3561,8 @@ ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_DOUBLE(tmp, value); zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC); } @@ -3573,8 +3573,8 @@ ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_STRING(tmp, value, 1); zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC); } @@ -3585,8 +3585,8 @@ ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_STRINGL(tmp, value, value_len, 1); zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC); } @@ -3597,8 +3597,8 @@ ZEND_API void zend_update_property_ascii_string(zend_class_entry *scope, zval *o zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_ASCII_STRING(tmp, value, 1); zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC); } @@ -3609,8 +3609,8 @@ ZEND_API void zend_update_property_ascii_stringl(zend_class_entry *scope, zval * zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_ASCII_STRINGL(tmp, value, value_len, 1); zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC); } @@ -3621,8 +3621,8 @@ ZEND_API void zend_update_property_rt_string(zend_class_entry *scope, zval *obje zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_RT_STRING(tmp, value, 1); zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC); } @@ -3633,8 +3633,8 @@ ZEND_API void zend_update_property_rt_stringl(zend_class_entry *scope, zval *obj zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_RT_STRINGL(tmp, value, value_len, 1); zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC); } @@ -3645,8 +3645,8 @@ ZEND_API void zend_update_property_unicode(zend_class_entry *scope, zval *object zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_UNICODE(tmp, value, 1); zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC); } @@ -3657,8 +3657,8 @@ ZEND_API void zend_update_property_unicodel(zend_class_entry *scope, zval *objec zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_UNICODEL(tmp, value, value_len, 1); zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC); } @@ -3680,13 +3680,13 @@ ZEND_API int zend_update_static_property(zend_class_entry *scope, char *name, in zval_dtor(*property); Z_TYPE_PP(property) = Z_TYPE_P(value); (*property)->value = value->value; - if (value->refcount > 0) { + if (Z_REFCOUNT_P(value) > 0) { zval_copy_ctor(*property); } } else { zval *garbage = *property; - value->refcount++; + Z_ADDREF_P(value); if (PZVAL_IS_REF(value)) { SEPARATE_ZVAL(&value); } @@ -3704,8 +3704,8 @@ ZEND_API int zend_update_static_property_null(zend_class_entry *scope, char *nam zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_NULL(tmp); return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC); } @@ -3716,8 +3716,8 @@ ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, char *nam zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_BOOL(tmp, value); return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC); } @@ -3728,8 +3728,8 @@ ZEND_API int zend_update_static_property_long(zend_class_entry *scope, char *nam zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_LONG(tmp, value); return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC); } @@ -3740,8 +3740,8 @@ ZEND_API int zend_update_static_property_double(zend_class_entry *scope, char *n zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_DOUBLE(tmp, value); return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC); } @@ -3752,8 +3752,8 @@ ZEND_API int zend_update_static_property_string(zend_class_entry *scope, char *n zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_STRING(tmp, value, 1); return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC); } @@ -3764,8 +3764,8 @@ ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, char * zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_STRINGL(tmp, value, value_len, 1); return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC); } @@ -3776,8 +3776,8 @@ ZEND_API int zend_update_static_property_ascii_string(zend_class_entry *scope, c zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_ASCII_STRING(tmp, value, 1); return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC); } @@ -3788,8 +3788,8 @@ ZEND_API int zend_update_static_property_ascii_stringl(zend_class_entry *scope, zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_ASCII_STRINGL(tmp, value, value_len, 1); return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC); } @@ -3800,8 +3800,8 @@ ZEND_API int zend_update_static_property_rt_string(zend_class_entry *scope, char zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_RT_STRING(tmp, value, 1); return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC); } @@ -3812,8 +3812,8 @@ ZEND_API int zend_update_static_property_rt_stringl(zend_class_entry *scope, cha zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_RT_STRINGL(tmp, value, value_len, 1); return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC); } @@ -3824,8 +3824,8 @@ ZEND_API int zend_update_static_property_unicode(zend_class_entry *scope, char * zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_UNICODE(tmp, value, 1); return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC); } @@ -3836,8 +3836,8 @@ ZEND_API int zend_update_static_property_unicodel(zend_class_entry *scope, char zval *tmp; ALLOC_ZVAL(tmp); - tmp->is_ref = 0; - tmp->refcount = 0; + Z_UNSET_ISREF_P(tmp); + Z_SET_REFCOUNT_P(tmp, 0); ZVAL_UNICODEL(tmp, value, value_len, 1); return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC); } |
