summaryrefslogtreecommitdiff
path: root/Zend/zend_API.c
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>1999-11-21 18:11:10 +0000
committerZeev Suraski <zeev@php.net>1999-11-21 18:11:10 +0000
commit6358c6631b278ffbb733a5d1eabd6f4101712509 (patch)
treee01ccb7c1762ab482241e32b290974b6b417afa2 /Zend/zend_API.c
parent5cc10ecec231640ea903992c9c84aa110441a211 (diff)
downloadphp-git-6358c6631b278ffbb733a5d1eabd6f4101712509.tar.gz
- Optimize class instanciation
- Fix constant instanciation for array elements inside objects
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r--Zend/zend_API.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index fdcda0c5be..81bf12a894 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -199,21 +199,17 @@ ZEND_API inline int array_init(zval *arg)
}
-static void zval_update_const_and_ref(zval **p)
-{
- zval_update_constant(*p);
- zval_add_ref(p);
-}
-
-
-
ZEND_API inline int object_init_ex(zval *arg, zend_class_entry *class_type)
{
zval *tmp;
+ if (!class_type->constants_updated) {
+ zend_hash_apply(&class_type->default_properties, (int (*)(void *)) zval_update_constant);
+ class_type->constants_updated = 1;
+ }
arg->value.obj.properties = (HashTable *) emalloc(sizeof(HashTable));
zend_hash_init(arg->value.obj.properties, 0, NULL, PVAL_PTR_DTOR, 0);
- zend_hash_copy(arg->value.obj.properties, &class_type->default_properties, (void (*)(void *)) zval_update_const_and_ref, (void *) &tmp, sizeof(zval *));
+ zend_hash_copy(arg->value.obj.properties, &class_type->default_properties, (void (*)(void *)) zval_add_ref, (void *) &tmp, sizeof(zval *));
arg->type = IS_OBJECT;
arg->value.obj.ce = class_type;
return SUCCESS;