Remove SEPARATE_ARG_IF_REF macro

The name doesn't correspond to what it does at all, and all the
existing usages appear to be unnecessary.

Usage of this macro can be replaced by ZVAL_DEREF + Z_TRY_ADDREF_P.
This commit is contained in:
Nikita Popov 2021-01-14 10:53:56 +01:00
parent cc4a247a5e
commit aa51785889
3 changed files with 0 additions and 29 deletions

View file

@ -1387,13 +1387,6 @@ static zend_always_inline uint32_t zval_delref_p(zval* pz) {
SEPARATE_ZVAL_IF_NOT_REF(_zv); \
} while (0)
#define SEPARATE_ARG_IF_REF(varptr) do { \
ZVAL_DEREF(varptr); \
if (Z_REFCOUNTED_P(varptr)) { \
Z_ADDREF_P(varptr); \
} \
} while (0)
/* Properties store a flag distinguishing unset and uninitialized properties
* (both use IS_UNDEF type) in the Z_EXTRA space. As such we also need to copy
* the Z_EXTRA space when copying property default values etc. We define separate

View file

@ -401,11 +401,8 @@ static zval *spl_array_read_dimension_ex(int check_inherited, zend_object *objec
if (!offset) {
ZVAL_UNDEF(&tmp);
offset = &tmp;
} else {
SEPARATE_ARG_IF_REF(offset);
}
zend_call_method_with_1_params(object, object->ce, &intern->fptr_offset_get, "offsetGet", rv, offset);
zval_ptr_dtor(offset);
if (!Z_ISUNDEF_P(rv)) {
return rv;
@ -447,11 +444,8 @@ static void spl_array_write_dimension_ex(int check_inherited, zend_object *objec
if (!offset) {
ZVAL_NULL(&tmp);
offset = &tmp;
} else {
SEPARATE_ARG_IF_REF(offset);
}
zend_call_method_with_2_params(object, object->ce, &intern->fptr_offset_set, "offsetSet", NULL, offset, value);
zval_ptr_dtor(offset);
return;
}
@ -517,9 +511,7 @@ static void spl_array_unset_dimension_ex(int check_inherited, zend_object *objec
spl_array_object *intern = spl_array_from_obj(object);
if (check_inherited && intern->fptr_offset_del) {
SEPARATE_ARG_IF_REF(offset);
zend_call_method_with_1_params(object, object->ce, &intern->fptr_offset_del, "offsetUnset", NULL, offset);
zval_ptr_dtor(offset);
return;
}
@ -598,9 +590,7 @@ static int spl_array_has_dimension_ex(int check_inherited, zend_object *object,
zval rv, *value = NULL, *tmp;
if (check_inherited && intern->fptr_offset_has) {
SEPARATE_ARG_IF_REF(offset);
zend_call_method_with_1_params(object, object->ce, &intern->fptr_offset_has, "offsetExists", &rv, offset);
zval_ptr_dtor(offset);
if (zend_is_true(&rv)) {
zval_ptr_dtor(&rv);

View file

@ -350,11 +350,8 @@ static zval *spl_fixedarray_object_read_dimension(zend_object *object, zval *off
if (!offset) {
ZVAL_NULL(&tmp);
offset = &tmp;
} else {
SEPARATE_ARG_IF_REF(offset);
}
zend_call_method_with_1_params(object, intern->std.ce, &intern->methods->fptr_offset_get, "offsetGet", rv, offset);
zval_ptr_dtor(offset);
if (!Z_ISUNDEF_P(rv)) {
return rv;
}
@ -400,13 +397,8 @@ static void spl_fixedarray_object_write_dimension(zend_object *object, zval *off
if (!offset) {
ZVAL_NULL(&tmp);
offset = &tmp;
} else {
SEPARATE_ARG_IF_REF(offset);
}
SEPARATE_ARG_IF_REF(value);
zend_call_method_with_2_params(object, intern->std.ce, &intern->methods->fptr_offset_set, "offsetSet", NULL, offset, value);
zval_ptr_dtor(value);
zval_ptr_dtor(offset);
return;
}
@ -439,9 +431,7 @@ static void spl_fixedarray_object_unset_dimension(zend_object *object, zval *off
intern = spl_fixed_array_from_obj(object);
if (UNEXPECTED(intern->methods && intern->methods->fptr_offset_del)) {
SEPARATE_ARG_IF_REF(offset);
zend_call_method_with_1_params(object, intern->std.ce, &intern->methods->fptr_offset_del, "offsetUnset", NULL, offset);
zval_ptr_dtor(offset);
return;
}
@ -482,9 +472,7 @@ static int spl_fixedarray_object_has_dimension(zend_object *object, zval *offset
zval rv;
zend_bool result;
SEPARATE_ARG_IF_REF(offset);
zend_call_method_with_1_params(object, intern->std.ce, &intern->methods->fptr_offset_has, "offsetExists", &rv, offset);
zval_ptr_dtor(offset);
result = zend_is_true(&rv);
zval_ptr_dtor(&rv);
return result;