Skip to content

Commit 718e55c

Browse files
committed
Add zend_array_release() function
To complement zend_string_release() and zend_object_release().
1 parent e41f764 commit 718e55c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Zend/zend_execute_API.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,7 @@ void shutdown_executor(void) /* {{{ */
305305
if (op_array->static_variables) {
306306
HashTable *ht = ZEND_MAP_PTR_GET(op_array->static_variables_ptr);
307307
if (ht) {
308-
if (!(GC_FLAGS(ht) & IS_ARRAY_IMMUTABLE) && GC_DELREF(ht) == 0) {
309-
zend_array_destroy(ht);
310-
}
308+
zend_array_release(ht);
311309
ZEND_MAP_PTR_SET(op_array->static_variables_ptr, NULL);
312310
}
313311
}

Zend/zend_hash.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,14 @@ static zend_always_inline void zend_hash_iterators_update(HashTable *ht, HashPos
324324
}
325325
}
326326

327+
static zend_always_inline void zend_array_release(zend_array *array)
328+
{
329+
if (!(GC_FLAGS(array) & IS_ARRAY_IMMUTABLE)) {
330+
if (GC_DELREF(array) == 0) {
331+
zend_array_destroy(array);
332+
}
333+
}
334+
}
327335

328336
END_EXTERN_C()
329337

0 commit comments

Comments
 (0)