cvs: ZendEngine2 / zend_objects.c

From: Date: Sat, 27 Dec 2003 20:33:15 +0000
Subject: cvs: ZendEngine2 / zend_objects.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-2157@lists.php.net to get a copy of this message
helly Sat Dec 27 15:33:15 2003 EDT Modified files: /ZendEngine2 zend_objects.c Log: Simplify Index: ZendEngine2/zend_objects.c diff -u ZendEngine2/zend_objects.c:1.38 ZendEngine2/zend_objects.c:1.39 --- ZendEngine2/zend_objects.c:1.38 Tue Sep 2 10:08:59 2003 +++ ZendEngine2/zend_objects.c Sat Dec 27 15:33:14 2003 @@ -17,12 +17,13 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_objects.c,v 1.38 2003/09/02 14:08:59 helly Exp $ */ +/* $Id: zend_objects.c,v 1.39 2003/12/27 20:33:14 helly Exp $ */ #include "zend.h" #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_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 @@ } } - 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); }

« previous php.zend-engine.cvs (#2157) next »