Skip to content

Commit 4884fec

Browse files
committed
zend_weakrefs: Remove layer of indirection in zend_weakrefs_hash_clean()
Following #16439.
1 parent 948ab10 commit 4884fec

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Zend/zend_weakrefs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,9 @@ ZEND_API zend_result zend_weakrefs_hash_del(HashTable *ht, zend_object *key) {
190190
ZEND_API void zend_weakrefs_hash_clean(HashTable *ht) {
191191
zend_ulong obj_key;
192192
ZEND_HASH_FOREACH_NUM_KEY(ht, obj_key) {
193-
zend_weakrefs_hash_del(ht, zend_weakref_key_to_object(obj_key));
193+
/* Call zend_weakref_unregister to avoid an unneccessary
194+
* zend_hash_index_find lookup in zend_weakrefs_hash_del. */
195+
zend_weakref_unregister(zend_weakref_key_to_object(obj_key), ZEND_WEAKREF_ENCODE(ht, ZEND_WEAKREF_TAG_BARE_HT), 1);
194196
} ZEND_HASH_FOREACH_END();
195197
}
196198

0 commit comments

Comments
 (0)