@@ -293,7 +293,7 @@ ZEND_API HashTable* ZEND_FASTCALL _zend_new_array(uint32_t nSize)
293293 return ht ;
294294}
295295
296- ZEND_API HashTable * ZEND_FASTCALL zend_new_pair (zval * val1 , zval * val2 )
296+ ZEND_API HashTable * ZEND_FASTCALL zend_new_pair (const zval * val1 , const zval * val2 )
297297{
298298 zval * zv ;
299299 HashTable * ht = emalloc (sizeof (HashTable ));
@@ -457,7 +457,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_discard(HashTable *ht, uint32_t nNumUsed)
457457 }
458458}
459459
460- static uint32_t zend_array_recalc_elements (HashTable * ht )
460+ static uint32_t zend_array_recalc_elements (const HashTable * ht )
461461{
462462 zval * val ;
463463 uint32_t num = ht -> nNumOfElements ;
@@ -671,10 +671,10 @@ ZEND_API void ZEND_FASTCALL zend_hash_iterator_del(uint32_t idx)
671671 }
672672}
673673
674- static zend_never_inline void ZEND_FASTCALL _zend_hash_iterators_remove (HashTable * ht )
674+ static zend_never_inline void ZEND_FASTCALL _zend_hash_iterators_remove (const HashTable * ht )
675675{
676676 HashTableIterator * iter = EG (ht_iterators );
677- HashTableIterator * end = iter + EG (ht_iterators_used );
677+ const HashTableIterator * end = iter + EG (ht_iterators_used );
678678
679679 while (iter != end ) {
680680 if (iter -> ht == ht ) {
@@ -684,17 +684,17 @@ static zend_never_inline void ZEND_FASTCALL _zend_hash_iterators_remove(HashTabl
684684 }
685685}
686686
687- static zend_always_inline void zend_hash_iterators_remove (HashTable * ht )
687+ static zend_always_inline void zend_hash_iterators_remove (const HashTable * ht )
688688{
689689 if (UNEXPECTED (HT_HAS_ITERATORS (ht ))) {
690690 _zend_hash_iterators_remove (ht );
691691 }
692692}
693693
694- ZEND_API HashPosition ZEND_FASTCALL zend_hash_iterators_lower_pos (HashTable * ht , HashPosition start )
694+ ZEND_API HashPosition ZEND_FASTCALL zend_hash_iterators_lower_pos (const HashTable * ht , HashPosition start )
695695{
696- HashTableIterator * iter = EG (ht_iterators );
697- HashTableIterator * end = iter + EG (ht_iterators_used );
696+ const HashTableIterator * iter = EG (ht_iterators );
697+ const HashTableIterator * end = iter + EG (ht_iterators_used );
698698 HashPosition res = ht -> nNumUsed ;
699699
700700 while (iter != end ) {
@@ -708,10 +708,10 @@ ZEND_API HashPosition ZEND_FASTCALL zend_hash_iterators_lower_pos(HashTable *ht,
708708 return res ;
709709}
710710
711- ZEND_API void ZEND_FASTCALL _zend_hash_iterators_update (HashTable * ht , HashPosition from , HashPosition to )
711+ ZEND_API void ZEND_FASTCALL _zend_hash_iterators_update (const HashTable * ht , HashPosition from , HashPosition to )
712712{
713713 HashTableIterator * iter = EG (ht_iterators );
714- HashTableIterator * end = iter + EG (ht_iterators_used );
714+ const HashTableIterator * end = iter + EG (ht_iterators_used );
715715
716716 while (iter != end ) {
717717 if (iter -> ht == ht && iter -> pos == from ) {
@@ -721,10 +721,10 @@ ZEND_API void ZEND_FASTCALL _zend_hash_iterators_update(HashTable *ht, HashPosit
721721 }
722722}
723723
724- ZEND_API void ZEND_FASTCALL zend_hash_iterators_advance (HashTable * ht , HashPosition step )
724+ ZEND_API void ZEND_FASTCALL zend_hash_iterators_advance (const HashTable * ht , HashPosition step )
725725{
726726 HashTableIterator * iter = EG (ht_iterators );
727- HashTableIterator * end = iter + EG (ht_iterators_used );
727+ const HashTableIterator * end = iter + EG (ht_iterators_used );
728728
729729 while (iter != end ) {
730730 if (iter -> ht == ht ) {
@@ -1429,11 +1429,11 @@ ZEND_API void ZEND_FASTCALL zend_hash_rehash(HashTable *ht)
14291429 }
14301430}
14311431
1432- static zend_always_inline void zend_hash_iterators_clamp_max (HashTable * ht , uint32_t max )
1432+ static zend_always_inline void zend_hash_iterators_clamp_max (const HashTable * ht , uint32_t max )
14331433{
14341434 if (UNEXPECTED (HT_HAS_ITERATORS (ht ))) {
14351435 HashTableIterator * iter = EG (ht_iterators );
1436- HashTableIterator * end = iter + EG (ht_iterators_used );
1436+ const HashTableIterator * end = iter + EG (ht_iterators_used );
14371437 while (iter != end ) {
14381438 if (iter -> ht == ht ) {
14391439 iter -> pos = MIN (iter -> pos , max );
@@ -2237,7 +2237,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_reverse_apply(HashTable *ht, apply_func_t
22372237}
22382238
22392239
2240- ZEND_API void ZEND_FASTCALL zend_hash_copy (HashTable * target , HashTable * source , copy_ctor_func_t pCopyConstructor )
2240+ ZEND_API void ZEND_FASTCALL zend_hash_copy (HashTable * target , const HashTable * source , copy_ctor_func_t pCopyConstructor )
22412241{
22422242 uint32_t idx ;
22432243 zval * new_entry , * data ;
@@ -2284,7 +2284,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_copy(HashTable *target, HashTable *source,
22842284}
22852285
22862286
2287- static zend_always_inline bool zend_array_dup_value (HashTable * source , HashTable * target , zval * data , zval * dest , bool packed , bool with_holes )
2287+ static zend_always_inline bool zend_array_dup_value (const HashTable * source , zval * data , zval * dest , bool packed , bool with_holes )
22882288{
22892289 if (with_holes ) {
22902290 if (!packed && Z_TYPE_INFO_P (data ) == IS_INDIRECT ) {
@@ -2321,9 +2321,9 @@ static zend_always_inline bool zend_array_dup_value(HashTable *source, HashTable
23212321 return 1 ;
23222322}
23232323
2324- static zend_always_inline bool zend_array_dup_element (HashTable * source , HashTable * target , uint32_t idx , Bucket * p , Bucket * q , bool packed , bool static_keys , bool with_holes )
2324+ static zend_always_inline bool zend_array_dup_element (const HashTable * source , HashTable * target , uint32_t idx , Bucket * p , Bucket * q , bool packed , bool static_keys , bool with_holes )
23252325{
2326- if (!zend_array_dup_value (source , target , & p -> val , & q -> val , packed , with_holes )) {
2326+ if (!zend_array_dup_value (source , & p -> val , & q -> val , packed , with_holes )) {
23272327 return 0 ;
23282328 }
23292329
@@ -2344,9 +2344,9 @@ static zend_always_inline bool zend_array_dup_element(HashTable *source, HashTab
23442344}
23452345
23462346// We need to duplicate iterators to be able to search through all copy-on-write copies to find the actually iterated HashTable and position back
2347- static void zend_array_dup_ht_iterators (HashTable * source , HashTable * target ) {
2347+ static void zend_array_dup_ht_iterators (const HashTable * source , HashTable * target ) {
23482348 HashTableIterator * iter = EG (ht_iterators );
2349- HashTableIterator * end = iter + EG (ht_iterators_used );
2349+ const HashTableIterator * end = iter + EG (ht_iterators_used );
23502350
23512351 while (iter != end ) {
23522352 if (iter -> ht == source ) {
@@ -2359,14 +2359,14 @@ static void zend_array_dup_ht_iterators(HashTable *source, HashTable *target) {
23592359 }
23602360}
23612361
2362- static zend_always_inline void zend_array_dup_packed_elements (HashTable * source , HashTable * target , bool with_holes )
2362+ static zend_always_inline void zend_array_dup_packed_elements (const HashTable * source , HashTable * target , bool with_holes )
23632363{
23642364 zval * p = source -> arPacked ;
23652365 zval * q = target -> arPacked ;
2366- zval * end = p + source -> nNumUsed ;
2366+ const zval * end = p + source -> nNumUsed ;
23672367
23682368 do {
2369- if (!zend_array_dup_value (source , target , p , q , 1 , with_holes )) {
2369+ if (!zend_array_dup_value (source , p , q , 1 , with_holes )) {
23702370 if (with_holes ) {
23712371 ZVAL_UNDEF (q );
23722372 }
@@ -2379,12 +2379,12 @@ static zend_always_inline void zend_array_dup_packed_elements(HashTable *source,
23792379 }
23802380}
23812381
2382- static zend_always_inline uint32_t zend_array_dup_elements (HashTable * source , HashTable * target , bool static_keys , bool with_holes )
2382+ static zend_always_inline uint32_t zend_array_dup_elements (const HashTable * source , HashTable * target , bool static_keys , bool with_holes )
23832383{
23842384 uint32_t idx = 0 ;
23852385 Bucket * p = source -> arData ;
23862386 Bucket * q = target -> arData ;
2387- Bucket * end = p + source -> nNumUsed ;
2387+ const Bucket * end = p + source -> nNumUsed ;
23882388
23892389 if (UNEXPECTED (HT_HAS_ITERATORS (source ))) {
23902390 zend_array_dup_ht_iterators (source , target );
@@ -2432,7 +2432,7 @@ static zend_always_inline uint32_t zend_array_dup_elements(HashTable *source, Ha
24322432 return idx ;
24332433}
24342434
2435- ZEND_API HashTable * ZEND_FASTCALL zend_array_dup (HashTable * source )
2435+ ZEND_API HashTable * ZEND_FASTCALL zend_array_dup (const HashTable * source )
24362436{
24372437 uint32_t idx ;
24382438 HashTable * target ;
@@ -2520,7 +2520,7 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(HashTable *source)
25202520 return target ;
25212521}
25222522
2523- ZEND_API HashTable * zend_array_to_list (HashTable * source )
2523+ ZEND_API HashTable * zend_array_to_list (const HashTable * source )
25242524{
25252525 HashTable * result = _zend_new_array (zend_hash_num_elements (source ));
25262526 zend_hash_real_init_packed (result );
@@ -2541,7 +2541,7 @@ ZEND_API HashTable* zend_array_to_list(HashTable *source)
25412541}
25422542
25432543
2544- ZEND_API void ZEND_FASTCALL zend_hash_merge (HashTable * target , HashTable * source , copy_ctor_func_t pCopyConstructor , bool overwrite )
2544+ ZEND_API void ZEND_FASTCALL zend_hash_merge (HashTable * target , const HashTable * source , copy_ctor_func_t pCopyConstructor , bool overwrite )
25452545{
25462546 uint32_t idx ;
25472547 Bucket * p ;
@@ -2637,7 +2637,7 @@ static bool ZEND_FASTCALL zend_hash_replace_checker_wrapper(HashTable *target, z
26372637}
26382638
26392639
2640- ZEND_API void ZEND_FASTCALL zend_hash_merge_ex (HashTable * target , HashTable * source , copy_ctor_func_t pCopyConstructor , merge_checker_func_t pMergeSource , void * pParam )
2640+ ZEND_API void ZEND_FASTCALL zend_hash_merge_ex (HashTable * target , const HashTable * source , copy_ctor_func_t pCopyConstructor , merge_checker_func_t pMergeSource , void * pParam )
26412641{
26422642 uint32_t idx ;
26432643 Bucket * p ;
@@ -2727,7 +2727,7 @@ ZEND_API zval* ZEND_FASTCALL _zend_hash_index_find(const HashTable *ht, zend_ulo
27272727 return p ? & p -> val : NULL ;
27282728}
27292729
2730- ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_reset_ex (HashTable * ht , HashPosition * pos )
2730+ ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_reset_ex (const HashTable * ht , HashPosition * pos )
27312731{
27322732 IS_CONSISTENT (ht );
27332733 HT_ASSERT (ht , & ht -> nInternalPointer != pos || GC_REFCOUNT (ht ) == 1 );
@@ -2738,7 +2738,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_reset_ex(HashTable *ht, H
27382738/* This function will be extremely optimized by remembering
27392739 * the end of the list
27402740 */
2741- ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_end_ex (HashTable * ht , HashPosition * pos )
2741+ ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_end_ex (const HashTable * ht , HashPosition * pos )
27422742{
27432743 uint32_t idx ;
27442744
@@ -2767,7 +2767,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_end_ex(HashTable *ht, Has
27672767}
27682768
27692769
2770- ZEND_API zend_result ZEND_FASTCALL zend_hash_move_forward_ex (HashTable * ht , HashPosition * pos )
2770+ ZEND_API zend_result ZEND_FASTCALL zend_hash_move_forward_ex (const HashTable * ht , HashPosition * pos )
27712771{
27722772 uint32_t idx ;
27732773
@@ -2806,7 +2806,7 @@ ZEND_API zend_result ZEND_FASTCALL zend_hash_move_forward_ex(HashTable *ht, Hash
28062806 }
28072807}
28082808
2809- ZEND_API zend_result ZEND_FASTCALL zend_hash_move_backwards_ex (HashTable * ht , HashPosition * pos )
2809+ ZEND_API zend_result ZEND_FASTCALL zend_hash_move_backwards_ex (const HashTable * ht , HashPosition * pos )
28102810{
28112811 uint32_t idx = * pos ;
28122812
@@ -2887,7 +2887,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_get_current_key_zval_ex(const HashTable *h
28872887 }
28882888}
28892889
2890- ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_type_ex (HashTable * ht , HashPosition * pos )
2890+ ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_type_ex (const HashTable * ht , const HashPosition * pos )
28912891{
28922892 uint32_t idx ;
28932893 Bucket * p ;
@@ -2909,7 +2909,7 @@ ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_type_ex(HashTable *ht, Hash
29092909}
29102910
29112911
2912- ZEND_API zval * ZEND_FASTCALL zend_hash_get_current_data_ex (HashTable * ht , HashPosition * pos )
2912+ ZEND_API zval * ZEND_FASTCALL zend_hash_get_current_data_ex (const HashTable * ht , const HashPosition * pos )
29132913{
29142914 uint32_t idx ;
29152915 Bucket * p ;
@@ -3063,7 +3063,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_sort_ex(HashTable *ht, sort_func_t sort, b
30633063 }
30643064}
30653065
3066- static zend_always_inline int zend_hash_compare_impl (HashTable * ht1 , HashTable * ht2 , compare_func_t compar , bool ordered ) {
3066+ static zend_always_inline int zend_hash_compare_impl (const HashTable * ht1 , const HashTable * ht2 , compare_func_t compar , bool ordered ) {
30673067 uint32_t idx1 , idx2 ;
30683068 zend_string * key1 , * key2 ;
30693069 zend_ulong h1 , h2 ;
0 commit comments