diff options
| author | Zeev Suraski <zeev@php.net> | 1999-11-21 18:11:10 +0000 |
|---|---|---|
| committer | Zeev Suraski <zeev@php.net> | 1999-11-21 18:11:10 +0000 |
| commit | 6358c6631b278ffbb733a5d1eabd6f4101712509 (patch) | |
| tree | e01ccb7c1762ab482241e32b290974b6b417afa2 /Zend/zend_API.c | |
| parent | 5cc10ecec231640ea903992c9c84aa110441a211 (diff) | |
| download | php-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.c | 14 |
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; |
