From c3a5b987710db9c7bf4ca1997cad30d6d192c83c Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Tue, 2 Jul 2024 10:11:41 -0700 Subject: [PATCH] Add zend_hash_get_current_pos_ex() (#14770) --- UPGRADING.INTERNALS | 2 ++ Zend/zend_hash.c | 5 +++++ Zend/zend_hash.h | 1 + 3 files changed, 8 insertions(+) diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index 5efce2c6971..66b3587a0ea 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -92,6 +92,8 @@ PHP 8.4 INTERNALS UPGRADE NOTES * zend_is_true now returns bool rather than int. Note that on PHP 8 this has always returned 0 or 1, so conversion should be trivial. +* Added zend_hash_get_current_pos_ex() variant of zend_hash_get_current_pos(). + ======================== 2. Build system changes ======================== diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 3cb31a6296e..220e25c358f 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -514,6 +514,11 @@ ZEND_API HashPosition ZEND_FASTCALL zend_hash_get_current_pos(const HashTable *h return _zend_hash_get_current_pos(ht); } +ZEND_API HashPosition ZEND_FASTCALL zend_hash_get_current_pos_ex(const HashTable *ht, HashPosition pos) +{ + return _zend_hash_get_valid_pos(ht, pos); +} + static void zend_hash_remove_iterator_copies(uint32_t idx) { HashTableIterator *iterators = EG(ht_iterators); diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index cd2caf7f3bb..3115bb9929d 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -245,6 +245,7 @@ static zend_always_inline bool zend_hash_index_exists(const HashTable *ht, zend_ } /* traversing */ +ZEND_API HashPosition ZEND_FASTCALL zend_hash_get_current_pos_ex(const HashTable *ht, HashPosition pos); ZEND_API HashPosition ZEND_FASTCALL zend_hash_get_current_pos(const HashTable *ht); ZEND_API zend_result ZEND_FASTCALL zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos);