summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-05-06 11:27:20 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-05-06 11:27:20 +0200
commit718e55c3e045a3b786749e0fbedda7f0ab444907 (patch)
treede1e1b340d54838c6fc31caf020bd045efb16e64
parente41f764b5c65c35df93de353250f3a7b6ae268b0 (diff)
downloadphp-git-718e55c3e045a3b786749e0fbedda7f0ab444907.tar.gz
Add zend_array_release() function
To complement zend_string_release() and zend_object_release().
-rw-r--r--Zend/zend_execute_API.c4
-rw-r--r--Zend/zend_hash.h8
2 files changed, 9 insertions, 3 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index ce801c3098..d98db72fba 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -305,9 +305,7 @@ void shutdown_executor(void) /* {{{ */
if (op_array->static_variables) {
HashTable *ht = ZEND_MAP_PTR_GET(op_array->static_variables_ptr);
if (ht) {
- if (!(GC_FLAGS(ht) & IS_ARRAY_IMMUTABLE) && GC_DELREF(ht) == 0) {
- zend_array_destroy(ht);
- }
+ zend_array_release(ht);
ZEND_MAP_PTR_SET(op_array->static_variables_ptr, NULL);
}
}
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
index 632658d938..d2b6ab2c71 100644
--- a/Zend/zend_hash.h
+++ b/Zend/zend_hash.h
@@ -324,6 +324,14 @@ static zend_always_inline void zend_hash_iterators_update(HashTable *ht, HashPos
}
}
+static zend_always_inline void zend_array_release(zend_array *array)
+{
+ if (!(GC_FLAGS(array) & IS_ARRAY_IMMUTABLE)) {
+ if (GC_DELREF(array) == 0) {
+ zend_array_destroy(array);
+ }
+ }
+}
END_EXTERN_C()