summaryrefslogtreecommitdiff
path: root/Zend/zend_objects_API.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2017-06-27 12:03:06 +0300
committerDmitry Stogov <dmitry@zend.com>2017-06-27 12:03:06 +0300
commit908ce66f73f78870b1159697a4276e273c767fa3 (patch)
tree7da104d8c0694e4a7d067e9142850c0bfaaaa67a /Zend/zend_objects_API.c
parentb6ee9dd490c1553a2b5223b74aef23e29169eced (diff)
downloadphp-git-908ce66f73f78870b1159697a4276e273c767fa3.tar.gz
Cleanup. Removed unused functions and unimplemented prototype. Avoid useless "dtor_obj" calls.
Diffstat (limited to 'Zend/zend_objects_API.c')
-rw-r--r--Zend/zend_objects_API.c38
1 files changed, 11 insertions, 27 deletions
diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c
index f838eddc97..6c622c6702 100644
--- a/Zend/zend_objects_API.c
+++ b/Zend/zend_objects_API.c
@@ -50,9 +50,14 @@ ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects)
if (IS_OBJ_VALID(obj)) {
if (!(GC_FLAGS(obj) & IS_OBJ_DESTRUCTOR_CALLED)) {
GC_FLAGS(obj) |= IS_OBJ_DESTRUCTOR_CALLED;
- GC_REFCOUNT(obj)++;
- obj->handlers->dtor_obj(obj);
- GC_REFCOUNT(obj)--;
+
+ if (obj->handlers->dtor_obj
+ && (obj->handlers->dtor_obj != zend_objects_destroy_object
+ || obj->ce->destructor)) {
+ GC_REFCOUNT(obj)++;
+ obj->handlers->dtor_obj(obj);
+ GC_REFCOUNT(obj)--;
+ }
}
}
}
@@ -149,17 +154,6 @@ ZEND_API void zend_objects_store_put(zend_object *object)
SET_OBJ_BUCKET_NUMBER(EG(objects_store).object_buckets[handle], EG(objects_store).free_list_head); \
EG(objects_store).free_list_head = handle;
-ZEND_API void zend_objects_store_free(zend_object *object) /* {{{ */
-{
- uint32_t handle = object->handle;
- void *ptr = ((char*)object) - object->handlers->offset;
-
- GC_REMOVE_FROM_BUFFER(object);
- efree(ptr);
- ZEND_OBJECTS_STORE_ADD_TO_FREE_LIST(handle);
-}
-/* }}} */
-
ZEND_API void zend_objects_store_del(zend_object *object) /* {{{ */
{
/* Make sure we hold a reference count during the destructor call
@@ -172,7 +166,9 @@ ZEND_API void zend_objects_store_del(zend_object *object) /* {{{ */
if (!(GC_FLAGS(object) & IS_OBJ_DESTRUCTOR_CALLED)) {
GC_FLAGS(object) |= IS_OBJ_DESTRUCTOR_CALLED;
- if (object->handlers->dtor_obj) {
+ if (object->handlers->dtor_obj
+ && (object->handlers->dtor_obj != zend_objects_destroy_object
+ || object->ce->destructor)) {
GC_REFCOUNT(object)++;
object->handlers->dtor_obj(object);
GC_REFCOUNT(object)--;
@@ -204,18 +200,6 @@ ZEND_API void zend_objects_store_del(zend_object *object) /* {{{ */
}
/* }}} */
-/* zend_object_store_set_object:
- * It is ONLY valid to call this function from within the constructor of an
- * overloaded object. Its purpose is to set the object pointer for the object
- * when you can't possibly know its value until you have parsed the arguments
- * from the constructor function. You MUST NOT use this function for any other
- * weird games, or call it at any other time after the object is constructed.
- * */
-ZEND_API void zend_object_store_set_object(zval *zobject, zend_object *object)
-{
- EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(zobject)] = object;
-}
-
ZEND_API zend_object_handlers *zend_get_std_object_handlers(void)
{
return &std_object_handlers;