@@ -293,7 +293,7 @@ ZEND_API HashTable* ZEND_FASTCALL _zend_new_array(uint32_t nSize)
293
293
return ht ;
294
294
}
295
295
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 )
297
297
{
298
298
zval * zv ;
299
299
HashTable * ht = emalloc (sizeof (HashTable ));
@@ -457,7 +457,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_discard(HashTable *ht, uint32_t nNumUsed)
457
457
}
458
458
}
459
459
460
- static uint32_t zend_array_recalc_elements (HashTable * ht )
460
+ static uint32_t zend_array_recalc_elements (const HashTable * ht )
461
461
{
462
462
zval * val ;
463
463
uint32_t num = ht -> nNumOfElements ;
@@ -671,10 +671,10 @@ ZEND_API void ZEND_FASTCALL zend_hash_iterator_del(uint32_t idx)
671
671
}
672
672
}
673
673
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 )
675
675
{
676
676
HashTableIterator * iter = EG (ht_iterators );
677
- HashTableIterator * end = iter + EG (ht_iterators_used );
677
+ const HashTableIterator * end = iter + EG (ht_iterators_used );
678
678
679
679
while (iter != end ) {
680
680
if (iter -> ht == ht ) {
@@ -684,17 +684,17 @@ static zend_never_inline void ZEND_FASTCALL _zend_hash_iterators_remove(HashTabl
684
684
}
685
685
}
686
686
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 )
688
688
{
689
689
if (UNEXPECTED (HT_HAS_ITERATORS (ht ))) {
690
690
_zend_hash_iterators_remove (ht );
691
691
}
692
692
}
693
693
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 )
695
695
{
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 );
698
698
HashPosition res = ht -> nNumUsed ;
699
699
700
700
while (iter != end ) {
@@ -708,10 +708,10 @@ ZEND_API HashPosition ZEND_FASTCALL zend_hash_iterators_lower_pos(HashTable *ht,
708
708
return res ;
709
709
}
710
710
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 )
712
712
{
713
713
HashTableIterator * iter = EG (ht_iterators );
714
- HashTableIterator * end = iter + EG (ht_iterators_used );
714
+ const HashTableIterator * end = iter + EG (ht_iterators_used );
715
715
716
716
while (iter != end ) {
717
717
if (iter -> ht == ht && iter -> pos == from ) {
@@ -721,10 +721,10 @@ ZEND_API void ZEND_FASTCALL _zend_hash_iterators_update(HashTable *ht, HashPosit
721
721
}
722
722
}
723
723
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 )
725
725
{
726
726
HashTableIterator * iter = EG (ht_iterators );
727
- HashTableIterator * end = iter + EG (ht_iterators_used );
727
+ const HashTableIterator * end = iter + EG (ht_iterators_used );
728
728
729
729
while (iter != end ) {
730
730
if (iter -> ht == ht ) {
@@ -1429,11 +1429,11 @@ ZEND_API void ZEND_FASTCALL zend_hash_rehash(HashTable *ht)
1429
1429
}
1430
1430
}
1431
1431
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 )
1433
1433
{
1434
1434
if (UNEXPECTED (HT_HAS_ITERATORS (ht ))) {
1435
1435
HashTableIterator * iter = EG (ht_iterators );
1436
- HashTableIterator * end = iter + EG (ht_iterators_used );
1436
+ const HashTableIterator * end = iter + EG (ht_iterators_used );
1437
1437
while (iter != end ) {
1438
1438
if (iter -> ht == ht ) {
1439
1439
iter -> pos = MIN (iter -> pos , max );
@@ -2237,7 +2237,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_reverse_apply(HashTable *ht, apply_func_t
2237
2237
}
2238
2238
2239
2239
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 )
2241
2241
{
2242
2242
uint32_t idx ;
2243
2243
zval * new_entry , * data ;
@@ -2284,7 +2284,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_copy(HashTable *target, HashTable *source,
2284
2284
}
2285
2285
2286
2286
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 )
2288
2288
{
2289
2289
if (with_holes ) {
2290
2290
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
2321
2321
return 1 ;
2322
2322
}
2323
2323
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 )
2325
2325
{
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 )) {
2327
2327
return 0 ;
2328
2328
}
2329
2329
@@ -2344,9 +2344,9 @@ static zend_always_inline bool zend_array_dup_element(HashTable *source, HashTab
2344
2344
}
2345
2345
2346
2346
// 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 ) {
2348
2348
HashTableIterator * iter = EG (ht_iterators );
2349
- HashTableIterator * end = iter + EG (ht_iterators_used );
2349
+ const HashTableIterator * end = iter + EG (ht_iterators_used );
2350
2350
2351
2351
while (iter != end ) {
2352
2352
if (iter -> ht == source ) {
@@ -2359,14 +2359,14 @@ static void zend_array_dup_ht_iterators(HashTable *source, HashTable *target) {
2359
2359
}
2360
2360
}
2361
2361
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 )
2363
2363
{
2364
2364
zval * p = source -> arPacked ;
2365
2365
zval * q = target -> arPacked ;
2366
- zval * end = p + source -> nNumUsed ;
2366
+ const zval * end = p + source -> nNumUsed ;
2367
2367
2368
2368
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 )) {
2370
2370
if (with_holes ) {
2371
2371
ZVAL_UNDEF (q );
2372
2372
}
@@ -2379,12 +2379,12 @@ static zend_always_inline void zend_array_dup_packed_elements(HashTable *source,
2379
2379
}
2380
2380
}
2381
2381
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 )
2383
2383
{
2384
2384
uint32_t idx = 0 ;
2385
2385
Bucket * p = source -> arData ;
2386
2386
Bucket * q = target -> arData ;
2387
- Bucket * end = p + source -> nNumUsed ;
2387
+ const Bucket * end = p + source -> nNumUsed ;
2388
2388
2389
2389
if (UNEXPECTED (HT_HAS_ITERATORS (source ))) {
2390
2390
zend_array_dup_ht_iterators (source , target );
@@ -2432,7 +2432,7 @@ static zend_always_inline uint32_t zend_array_dup_elements(HashTable *source, Ha
2432
2432
return idx ;
2433
2433
}
2434
2434
2435
- ZEND_API HashTable * ZEND_FASTCALL zend_array_dup (HashTable * source )
2435
+ ZEND_API HashTable * ZEND_FASTCALL zend_array_dup (const HashTable * source )
2436
2436
{
2437
2437
uint32_t idx ;
2438
2438
HashTable * target ;
@@ -2520,7 +2520,7 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(HashTable *source)
2520
2520
return target ;
2521
2521
}
2522
2522
2523
- ZEND_API HashTable * zend_array_to_list (HashTable * source )
2523
+ ZEND_API HashTable * zend_array_to_list (const HashTable * source )
2524
2524
{
2525
2525
HashTable * result = _zend_new_array (zend_hash_num_elements (source ));
2526
2526
zend_hash_real_init_packed (result );
@@ -2541,7 +2541,7 @@ ZEND_API HashTable* zend_array_to_list(HashTable *source)
2541
2541
}
2542
2542
2543
2543
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 )
2545
2545
{
2546
2546
uint32_t idx ;
2547
2547
Bucket * p ;
@@ -2637,7 +2637,7 @@ static bool ZEND_FASTCALL zend_hash_replace_checker_wrapper(HashTable *target, z
2637
2637
}
2638
2638
2639
2639
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 )
2641
2641
{
2642
2642
uint32_t idx ;
2643
2643
Bucket * p ;
@@ -2727,7 +2727,7 @@ ZEND_API zval* ZEND_FASTCALL _zend_hash_index_find(const HashTable *ht, zend_ulo
2727
2727
return p ? & p -> val : NULL ;
2728
2728
}
2729
2729
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 )
2731
2731
{
2732
2732
IS_CONSISTENT (ht );
2733
2733
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
2738
2738
/* This function will be extremely optimized by remembering
2739
2739
* the end of the list
2740
2740
*/
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 )
2742
2742
{
2743
2743
uint32_t idx ;
2744
2744
@@ -2767,7 +2767,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_end_ex(HashTable *ht, Has
2767
2767
}
2768
2768
2769
2769
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 )
2771
2771
{
2772
2772
uint32_t idx ;
2773
2773
@@ -2806,7 +2806,7 @@ ZEND_API zend_result ZEND_FASTCALL zend_hash_move_forward_ex(HashTable *ht, Hash
2806
2806
}
2807
2807
}
2808
2808
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 )
2810
2810
{
2811
2811
uint32_t idx = * pos ;
2812
2812
@@ -2887,7 +2887,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_get_current_key_zval_ex(const HashTable *h
2887
2887
}
2888
2888
}
2889
2889
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 )
2891
2891
{
2892
2892
uint32_t idx ;
2893
2893
Bucket * p ;
@@ -2909,7 +2909,7 @@ ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_type_ex(HashTable *ht, Hash
2909
2909
}
2910
2910
2911
2911
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 )
2913
2913
{
2914
2914
uint32_t idx ;
2915
2915
Bucket * p ;
@@ -3063,7 +3063,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_sort_ex(HashTable *ht, sort_func_t sort, b
3063
3063
}
3064
3064
}
3065
3065
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 ) {
3067
3067
uint32_t idx1 , idx2 ;
3068
3068
zend_string * key1 , * key2 ;
3069
3069
zend_ulong h1 , h2 ;
0 commit comments