diff options
author | Marcus Boerger <helly@php.net> | 2003-12-27 20:33:14 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2003-12-27 20:33:14 +0000 |
commit | e20f534ee5fd5b6288aae5ca14bf9bf1d5f46185 (patch) | |
tree | debe99530f06b3423a1d66f73c5bda81587bd22b /Zend/zend_objects.c | |
parent | db36fd0200972594a37c98c2d742bda8c9c4da84 (diff) | |
download | php-git-e20f534ee5fd5b6288aae5ca14bf9bf1d5f46185.tar.gz |
Simplify
Diffstat (limited to 'Zend/zend_objects.c')
-rw-r--r-- | Zend/zend_objects.c | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c index 67e943428a..172ca0f8fe 100644 --- a/Zend/zend_objects.c +++ b/Zend/zend_objects.c @@ -23,6 +23,7 @@ #include "zend_globals.h" #include "zend_variables.h" #include "zend_API.h" +#include "zend_interfaces.h" static inline void zend_nuke_object(zend_object *object TSRMLS_DC) { @@ -36,10 +37,7 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl zend_function *destructor = object->ce->destructor; if (destructor) { - zval *obj; - zval *destructor_func_name; - zval *retval_ptr; - HashTable symbol_table; + zval zobj, *obj = &zobj; if (destructor->op_array.fn_flags & (ZEND_ACC_PRIVATE|ZEND_ACC_PROTECTED)) { if (destructor->op_array.fn_flags & ZEND_ACC_PRIVATE) { @@ -73,28 +71,12 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl } } - MAKE_STD_ZVAL(obj); - obj->type = IS_OBJECT; - obj->value.obj.handle = handle; - obj->value.obj.handlers = &std_object_handlers; - zval_copy_ctor(obj); - - ZEND_INIT_SYMTABLE(&symbol_table); - - /* FIXME: Optimize this so that we use the old_object->ce->destructor function pointer instead of the name */ - MAKE_STD_ZVAL(destructor_func_name); - destructor_func_name->type = IS_STRING; - destructor_func_name->value.str.val = estrndup("__destruct", sizeof("__destruct")-1); - destructor_func_name->value.str.len = sizeof("__destruct")-1; + zobj.type = IS_OBJECT; + zobj.value.obj.handle = handle; + zobj.value.obj.handlers = &std_object_handlers; + INIT_PZVAL(obj); - call_user_function_ex(NULL, &obj, destructor_func_name, &retval_ptr, 0, NULL, 0, &symbol_table TSRMLS_CC); - - zend_hash_destroy(&symbol_table); - zval_ptr_dtor(&obj); - zval_ptr_dtor(&destructor_func_name); - if (retval_ptr) { - zval_ptr_dtor(&retval_ptr); - } + zend_call_method_with_0_params(&obj, object->ce, NULL, "__destruct", NULL); } zend_nuke_object(object TSRMLS_CC); } |