summaryrefslogtreecommitdiff
path: root/Zend/zend_list.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-04-15 10:49:44 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-04-15 11:01:12 +0200
commit90435637756fb8c473938853bc6d3ecfa9f2eeff (patch)
tree9f5b22fb9b04e009e929658e1f3f1e313dd32a86 /Zend/zend_list.c
parente15409b43cacf711608189c299191f2969ea331c (diff)
downloadphp-git-90435637756fb8c473938853bc6d3ecfa9f2eeff.tar.gz
Make zend_list_free return void
And assert that the refcount is zero. This function should only be used internally as the resource destructor.
Diffstat (limited to 'Zend/zend_list.c')
-rw-r--r--Zend/zend_list.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/Zend/zend_list.c b/Zend/zend_list.c
index 2288cf6913..3464ca27d5 100644
--- a/Zend/zend_list.c
+++ b/Zend/zend_list.c
@@ -51,13 +51,10 @@ ZEND_API int ZEND_FASTCALL zend_list_delete(zend_resource *res)
}
}
-ZEND_API int ZEND_FASTCALL zend_list_free(zend_resource *res)
+ZEND_API void ZEND_FASTCALL zend_list_free(zend_resource *res)
{
- if (GC_REFCOUNT(res) <= 0) {
- return zend_hash_index_del(&EG(regular_list), res->handle);
- } else {
- return SUCCESS;
- }
+ ZEND_ASSERT(GC_REFCOUNT(res) == 0);
+ zend_hash_index_del(&EG(regular_list), res->handle);
}
static void zend_resource_dtor(zend_resource *res)
@@ -82,7 +79,7 @@ static void zend_resource_dtor(zend_resource *res)
ZEND_API int ZEND_FASTCALL zend_list_close(zend_resource *res)
{
if (GC_REFCOUNT(res) <= 0) {
- return zend_list_free(res);
+ zend_list_free(res);
} else if (res->type >= 0) {
zend_resource_dtor(res);
}