diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2021-01-14 10:53:56 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-01-14 10:53:56 +0100 |
commit | aa517858898e8bd8bfab0b83748dcca9bf616edf (patch) | |
tree | 6f6f7270ce20efa3170591e7b900554ca900cea7 | |
parent | cc4a247a5ee82075cdfd22953fbac18d168e1334 (diff) | |
download | php-git-aa517858898e8bd8bfab0b83748dcca9bf616edf.tar.gz |
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.
-rw-r--r-- | Zend/zend_types.h | 7 | ||||
-rw-r--r-- | ext/spl/spl_array.c | 10 | ||||
-rw-r--r-- | ext/spl/spl_fixedarray.c | 12 |
3 files changed, 0 insertions, 29 deletions
diff --git a/Zend/zend_types.h b/Zend/zend_types.h index 82cf20f1b5..7ec8fe3b96 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -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 diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index d2300632b6..176e507a49 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -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); diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index 3289969037..4c7ff5dd35 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -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; |