diff options
author | Dmitry Stogov <dmitry@zend.com> | 2014-05-27 00:38:58 +0400 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2014-05-27 00:38:58 +0400 |
commit | e34a6e9211559827d7747e028f46ebe92e334d2d (patch) | |
tree | 32b770ce3cc8fa4ef707c513d4fb16930bd57f4f /Zend/zend_API.c | |
parent | 05d0df4706f7b7a499a9569cde0939e252491afc (diff) | |
download | php-git-e34a6e9211559827d7747e028f46ebe92e334d2d.tar.gz |
Use new zend_hash API
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r-- | Zend/zend_API.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 01cdefcc13..2bafa8586a 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -1095,31 +1095,25 @@ ZEND_API int _array_init(zval *arg, uint size ZEND_FILE_LINE_DC) /* {{{ */ } /* }}} */ -static int zend_merge_property(zval *value TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ -{ - /* which name should a numeric property have ? */ - if (hash_key->key) { - zval *obj = va_arg(args, zval *); - zend_object_handlers *obj_ht = va_arg(args, zend_object_handlers *); - zval member; - - ZVAL_STR(&member, STR_COPY(hash_key->key)); - obj_ht->write_property(obj, &member, value, -1 TSRMLS_CC); - zval_ptr_dtor(&member); - } - return ZEND_HASH_APPLY_KEEP; -} -/* }}} */ - /* This function should be called after the constructor has been called * because it may call __set from the uninitialized object otherwise. */ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destroy_ht TSRMLS_DC) /* {{{ */ { const zend_object_handlers *obj_ht = Z_OBJ_HT_P(obj); zend_class_entry *old_scope = EG(scope); + zend_string *key; + zval *value; EG(scope) = Z_OBJCE_P(obj); - zend_hash_apply_with_arguments(properties TSRMLS_CC, zend_merge_property, 2, obj, obj_ht); + ZEND_HASH_FOREACH_STR_KEY_VAL(properties, key, value) { + if (key) { + zval member; + + ZVAL_STR(&member, STR_COPY(key)); + obj_ht->write_property(obj, &member, value, -1 TSRMLS_CC); + zval_ptr_dtor(&member); + } + } ZEND_HASH_FOREACH_END(); EG(scope) = old_scope; if (destroy_ht) { |