mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Add some const qualifiers in HashTable foreach macros (#8671)
This commit is contained in:
committed by
GitHub
parent
f119b61d03
commit
76a773b8dd
@@ -998,7 +998,7 @@ static zend_always_inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht,
|
||||
((zval*)(((char*)(_el)) - (_size)))
|
||||
|
||||
#define _ZEND_HASH_FOREACH_VAL(_ht) do { \
|
||||
HashTable *__ht = (_ht); \
|
||||
const HashTable *__ht = (_ht); \
|
||||
uint32_t _count = __ht->nNumUsed; \
|
||||
size_t _size = ZEND_HASH_ELEMENT_SIZE(__ht); \
|
||||
zval *_z = __ht->arPacked; \
|
||||
@@ -1006,7 +1006,7 @@ static zend_always_inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht,
|
||||
if (UNEXPECTED(Z_TYPE_P(_z) == IS_UNDEF)) continue;
|
||||
|
||||
#define _ZEND_HASH_REVERSE_FOREACH_VAL(_ht) do { \
|
||||
HashTable *__ht = (_ht); \
|
||||
const HashTable *__ht = (_ht); \
|
||||
uint32_t _idx = __ht->nNumUsed; \
|
||||
size_t _size = ZEND_HASH_ELEMENT_SIZE(__ht); \
|
||||
zval *_z = ZEND_HASH_ELEMENT_EX(__ht, _idx, _size); \
|
||||
@@ -1015,7 +1015,7 @@ static zend_always_inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht,
|
||||
if (UNEXPECTED(Z_TYPE_P(_z) == IS_UNDEF)) continue;
|
||||
|
||||
#define ZEND_HASH_FOREACH_FROM(_ht, indirect, _from) do { \
|
||||
HashTable *__ht = (_ht); \
|
||||
const HashTable *__ht = (_ht); \
|
||||
zend_ulong __h; \
|
||||
zend_string *__key = NULL; \
|
||||
uint32_t _idx = (_from); \
|
||||
@@ -1043,7 +1043,7 @@ static zend_always_inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht,
|
||||
#define ZEND_HASH_FOREACH(_ht, indirect) ZEND_HASH_FOREACH_FROM(_ht, indirect, 0)
|
||||
|
||||
#define ZEND_HASH_REVERSE_FOREACH(_ht, indirect) do { \
|
||||
HashTable *__ht = (_ht); \
|
||||
const HashTable *__ht = (_ht); \
|
||||
uint32_t _idx = __ht->nNumUsed; \
|
||||
zval *_z; \
|
||||
zend_ulong __h; \
|
||||
@@ -1232,9 +1232,9 @@ static zend_always_inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht,
|
||||
|
||||
/* Hash array iterators */
|
||||
#define ZEND_HASH_MAP_FOREACH_FROM(_ht, indirect, _from) do { \
|
||||
HashTable *__ht = (_ht); \
|
||||
const HashTable *__ht = (_ht); \
|
||||
Bucket *_p = __ht->arData + (_from); \
|
||||
Bucket *_end = __ht->arData + __ht->nNumUsed; \
|
||||
const Bucket *_end = __ht->arData + __ht->nNumUsed; \
|
||||
ZEND_ASSERT(!HT_IS_PACKED(__ht)); \
|
||||
for (; _p != _end; _p++) { \
|
||||
zval *_z = &_p->val; \
|
||||
@@ -1246,7 +1246,7 @@ static zend_always_inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht,
|
||||
#define ZEND_HASH_MAP_FOREACH(_ht, indirect) ZEND_HASH_MAP_FOREACH_FROM(_ht, indirect, 0)
|
||||
|
||||
#define ZEND_HASH_MAP_REVERSE_FOREACH(_ht, indirect) do { \
|
||||
HashTable *__ht = (_ht); \
|
||||
/* const */ HashTable *__ht = (_ht); \
|
||||
uint32_t _idx = __ht->nNumUsed; \
|
||||
Bucket *_p = __ht->arData + _idx; \
|
||||
zval *_z; \
|
||||
@@ -1440,7 +1440,7 @@ static zend_always_inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht,
|
||||
|
||||
/* Packed array iterators */
|
||||
#define ZEND_HASH_PACKED_FOREACH_FROM(_ht, _from) do { \
|
||||
HashTable *__ht = (_ht); \
|
||||
const HashTable *__ht = (_ht); \
|
||||
zend_ulong _idx = (_from); \
|
||||
zval *_z = __ht->arPacked + (_from); \
|
||||
zval *_end = __ht->arPacked + __ht->nNumUsed; \
|
||||
@@ -1452,7 +1452,7 @@ static zend_always_inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht,
|
||||
#define ZEND_HASH_PACKED_FOREACH(_ht) ZEND_HASH_PACKED_FOREACH_FROM(_ht, 0)
|
||||
|
||||
#define ZEND_HASH_PACKED_REVERSE_FOREACH(_ht) do { \
|
||||
HashTable *__ht = (_ht); \
|
||||
const HashTable *__ht = (_ht); \
|
||||
zend_ulong _idx = __ht->nNumUsed; \
|
||||
zval *_z = __ht->arPacked + _idx; \
|
||||
ZEND_ASSERT(HT_IS_PACKED(__ht)); \
|
||||
|
||||
Reference in New Issue
Block a user