diff options
author | Dmitry Stogov <dmitry@zend.com> | 2019-01-31 18:47:58 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2019-02-04 13:20:25 +0300 |
commit | 91ef4124e56a8ec52078bdcb5547ea5dbf654566 (patch) | |
tree | 14285f0ab29d8274b8aeb7003ca7d0c77bbd604f /ext/zip/php_zip.c | |
parent | 0476d558272c18778f95c0368e18108771a63d99 (diff) | |
download | php-git-91ef4124e56a8ec52078bdcb5547ea5dbf654566.tar.gz |
Refactor zend_object_handlers API to pass zend_object* and zend_string* insted of zval(s).
Diffstat (limited to 'ext/zip/php_zip.c')
-rw-r--r-- | ext/zip/php_zip.c | 63 |
1 files changed, 15 insertions, 48 deletions
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 9275ab1c46..6c4ada63bd 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -872,54 +872,36 @@ static zval *php_zip_property_reader(ze_zip_object *obj, zip_prop_handler *hnd, } /* }}} */ -static zval *php_zip_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */ +static zval *php_zip_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot) /* {{{ */ { ze_zip_object *obj; - zval tmp_member; zval *retval = NULL; zip_prop_handler *hnd = NULL; - if (Z_TYPE_P(member) != IS_STRING) { - ZVAL_STR(&tmp_member, zval_get_string_func(member)); - member = &tmp_member; - cache_slot = NULL; - } - - obj = Z_ZIP_P(object); + obj = php_zip_fetch_object(object); if (obj->prop_handler != NULL) { - hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member)); + hnd = zend_hash_find_ptr(obj->prop_handler, name); } if (hnd == NULL) { - retval = zend_std_get_property_ptr_ptr(object, member, type, cache_slot); - } - - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); + retval = zend_std_get_property_ptr_ptr(object, name, type, cache_slot); } return retval; } /* }}} */ -static zval *php_zip_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */ +static zval *php_zip_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv) /* {{{ */ { ze_zip_object *obj; - zval tmp_member; zval *retval = NULL; zip_prop_handler *hnd = NULL; - if (Z_TYPE_P(member) != IS_STRING) { - ZVAL_STR(&tmp_member, zval_get_string_func(member)); - member = &tmp_member; - cache_slot = NULL; - } - - obj = Z_ZIP_P(object); + obj = php_zip_fetch_object(object); if (obj->prop_handler != NULL) { - hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member)); + hnd = zend_hash_find_ptr(obj->prop_handler, name); } if (hnd != NULL) { @@ -928,34 +910,23 @@ static zval *php_zip_read_property(zval *object, zval *member, int type, void ** retval = &EG(uninitialized_zval); } } else { - retval = zend_std_read_property(object, member, type, cache_slot, rv); - } - - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); + retval = zend_std_read_property(object, name, type, cache_slot, rv); } return retval; } /* }}} */ -static int php_zip_has_property(zval *object, zval *member, int type, void **cache_slot) /* {{{ */ +static int php_zip_has_property(zend_object *object, zend_string *name, int type, void **cache_slot) /* {{{ */ { ze_zip_object *obj; - zval tmp_member; zip_prop_handler *hnd = NULL; int retval = 0; - if (Z_TYPE_P(member) != IS_STRING) { - ZVAL_STR(&tmp_member, zval_get_string_func(member)); - member = &tmp_member; - cache_slot = NULL; - } - - obj = Z_ZIP_P(object); + obj = php_zip_fetch_object(object); if (obj->prop_handler != NULL) { - hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member)); + hnd = zend_hash_find_ptr(obj->prop_handler, name); } if (hnd != NULL) { @@ -973,18 +944,14 @@ static int php_zip_has_property(zval *object, zval *member, int type, void **cac zval_ptr_dtor(&tmp); } else { - retval = zend_std_has_property(object, member, type, cache_slot); - } - - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); + retval = zend_std_has_property(object, name, type, cache_slot); } return retval; } /* }}} */ -static HashTable *php_zip_get_gc(zval *object, zval **gc_data, int *gc_data_count) /* {{{ */ +static HashTable *php_zip_get_gc(zend_object *object, zval **gc_data, int *gc_data_count) /* {{{ */ { *gc_data = NULL; *gc_data_count = 0; @@ -992,14 +959,14 @@ static HashTable *php_zip_get_gc(zval *object, zval **gc_data, int *gc_data_coun } /* }}} */ -static HashTable *php_zip_get_properties(zval *object)/* {{{ */ +static HashTable *php_zip_get_properties(zend_object *object)/* {{{ */ { ze_zip_object *obj; HashTable *props; zip_prop_handler *hnd; zend_string *key; - obj = Z_ZIP_P(object); + obj = php_zip_fetch_object(object); props = zend_std_get_properties(object); if (obj->prop_handler == NULL) { |