@@ -126,25 +126,25 @@ static zend_never_inline ZEND_COLD int stable_sort_fallback(Bucket *a, Bucket *b
126
126
127
127
static zend_always_inline int php_array_key_compare_unstable_i (Bucket * f , Bucket * s ) /* {{{ */
128
128
{
129
- zval first ;
130
- zval second ;
131
-
132
- if (f -> key == NULL && s -> key == NULL ) {
133
- return (zend_long )f -> h > (zend_long )s -> h ? 1 : -1 ;
134
- } else if (f -> key && s -> key ) {
135
- return zendi_smart_strcmp (f -> key , s -> key );
136
- }
137
- if (f -> key ) {
138
- ZVAL_STR (& first , f -> key );
139
- } else {
140
- ZVAL_LONG (& first , f -> h );
141
- }
142
- if (s -> key ) {
143
- ZVAL_STR (& second , s -> key );
144
- } else {
145
- ZVAL_LONG (& second , s -> h );
146
- }
147
- return zend_compare (& first , & second );
129
+ zval first ;
130
+ zval second ;
131
+
132
+ if (f -> key == NULL && s -> key == NULL ) {
133
+ return (zend_long )f -> h > (zend_long )s -> h ? 1 : -1 ;
134
+ } else if (f -> key && s -> key ) {
135
+ return zendi_smart_strcmp (f -> key , s -> key );
136
+ }
137
+ if (f -> key ) {
138
+ ZVAL_STR (& first , f -> key );
139
+ } else {
140
+ ZVAL_LONG (& first , f -> h );
141
+ }
142
+ if (s -> key ) {
143
+ ZVAL_STR (& second , s -> key );
144
+ } else {
145
+ ZVAL_LONG (& second , s -> h );
146
+ }
147
+ return zend_compare (& first , & second );
148
148
}
149
149
/* }}} */
150
150
@@ -1210,7 +1210,7 @@ static int php_data_compare(const void *f, const void *s) /* {{{ */
1210
1210
Return the lowest value in an array or a series of arguments */
1211
1211
PHP_FUNCTION (min )
1212
1212
{
1213
- int argc ;
1213
+ uint32_t argc ;
1214
1214
zval * args = NULL ;
1215
1215
1216
1216
ZEND_PARSE_PARAMETERS_START (1 , -1 )
@@ -1234,7 +1234,7 @@ PHP_FUNCTION(min)
1234
1234
} else {
1235
1235
/* mixed min ( mixed $value1 , mixed $value2 [, mixed $value3... ] ) */
1236
1236
zval * min , result ;
1237
- int i ;
1237
+ uint32_t i ;
1238
1238
1239
1239
min = & args [0 ];
1240
1240
@@ -1257,7 +1257,7 @@ PHP_FUNCTION(min)
1257
1257
PHP_FUNCTION (max )
1258
1258
{
1259
1259
zval * args = NULL ;
1260
- int argc ;
1260
+ uint32_t argc ;
1261
1261
1262
1262
ZEND_PARSE_PARAMETERS_START (1 , -1 )
1263
1263
Z_PARAM_VARIADIC ('+' , args , argc )
@@ -1280,7 +1280,7 @@ PHP_FUNCTION(max)
1280
1280
} else {
1281
1281
/* mixed max ( mixed $value1 , mixed $value2 [, mixed $value3... ] ) */
1282
1282
zval * max , result ;
1283
- int i ;
1283
+ uint32_t i ;
1284
1284
1285
1285
max = & args [0 ];
1286
1286
@@ -2525,7 +2525,7 @@ static void php_compact_var(HashTable *eg_active_symbol_table, zval *return_valu
2525
2525
php_error_docref (NULL , E_WARNING , "Undefined variable $%s" , ZSTR_VAL (Z_STR_P (entry )));
2526
2526
}
2527
2527
} else if (Z_TYPE_P (entry ) == IS_ARRAY ) {
2528
- if (Z_REFCOUNTED_P (entry )) {
2528
+ if (Z_REFCOUNTED_P (entry )) {
2529
2529
if (Z_IS_RECURSIVE_P (entry )) {
2530
2530
zend_throw_error (NULL , "Recursion detected" );
2531
2531
return ;
@@ -2535,7 +2535,7 @@ static void php_compact_var(HashTable *eg_active_symbol_table, zval *return_valu
2535
2535
ZEND_HASH_FOREACH_VAL (Z_ARRVAL_P (entry ), value_ptr ) {
2536
2536
php_compact_var (eg_active_symbol_table , return_value , value_ptr , pos );
2537
2537
} ZEND_HASH_FOREACH_END ();
2538
- if (Z_REFCOUNTED_P (entry )) {
2538
+ if (Z_REFCOUNTED_P (entry )) {
2539
2539
Z_UNPROTECT_RECURSION_P (entry );
2540
2540
}
2541
2541
} else {
@@ -3179,8 +3179,7 @@ PHP_FUNCTION(array_push)
3179
3179
zval * args , /* Function arguments array */
3180
3180
* stack , /* Input array */
3181
3181
new_var ; /* Variable to be pushed */
3182
- int i , /* Loop counter */
3183
- argc ; /* Number of function arguments */
3182
+ uint32_t argc ; /* Number of function arguments */
3184
3183
3185
3184
3186
3185
ZEND_PARSE_PARAMETERS_START (1 , -1 )
@@ -3189,7 +3188,7 @@ PHP_FUNCTION(array_push)
3189
3188
ZEND_PARSE_PARAMETERS_END ();
3190
3189
3191
3190
/* For each subsequent argument, make it a reference, increase refcount, and add it to the end of the array */
3192
- for (i = 0 ; i < argc ; i ++ ) {
3191
+ for (uint32_t i = 0 ; i < argc ; i ++ ) {
3193
3192
ZVAL_COPY (& new_var , & args [i ]);
3194
3193
3195
3194
if (zend_hash_next_index_insert (Z_ARRVAL_P (stack ), & new_var ) == NULL ) {
@@ -3387,8 +3386,7 @@ PHP_FUNCTION(array_unshift)
3387
3386
zval * args , /* Function arguments array */
3388
3387
* stack ; /* Input stack */
3389
3388
HashTable new_hash ; /* New hashtable for the stack */
3390
- int argc ; /* Number of function arguments */
3391
- int i ;
3389
+ uint32_t argc ; /* Number of function arguments */
3392
3390
zend_string * key ;
3393
3391
zval * value ;
3394
3392
@@ -3398,7 +3396,7 @@ PHP_FUNCTION(array_unshift)
3398
3396
ZEND_PARSE_PARAMETERS_END ();
3399
3397
3400
3398
zend_hash_init (& new_hash , zend_hash_num_elements (Z_ARRVAL_P (stack )) + argc , NULL , ZVAL_PTR_DTOR , 0 );
3401
- for (i = 0 ; i < argc ; i ++ ) {
3399
+ for (uint32_t i = 0 ; i < argc ; i ++ ) {
3402
3400
Z_TRY_ADDREF (args [i ]);
3403
3401
zend_hash_next_index_insert_new (& new_hash , & args [i ]);
3404
3402
}
@@ -3818,8 +3816,8 @@ PHPAPI int php_array_replace_recursive(HashTable *dest, HashTable *src) /* {{{ *
3818
3816
dest_zval = dest_entry ;
3819
3817
ZVAL_DEREF (dest_zval );
3820
3818
if (Z_IS_RECURSIVE_P (dest_zval ) ||
3821
- Z_IS_RECURSIVE_P (src_zval ) ||
3822
- (Z_ISREF_P (src_entry ) && Z_ISREF_P (dest_entry ) && Z_REF_P (src_entry ) == Z_REF_P (dest_entry ) && (Z_REFCOUNT_P (dest_entry ) % 2 ))) {
3819
+ Z_IS_RECURSIVE_P (src_zval ) ||
3820
+ (Z_ISREF_P (src_entry ) && Z_ISREF_P (dest_entry ) && Z_REF_P (src_entry ) == Z_REF_P (dest_entry ) && (Z_REFCOUNT_P (dest_entry ) % 2 ))) {
3823
3821
zend_throw_error (NULL , "Recursion detected" );
3824
3822
return 0 ;
3825
3823
}
@@ -3857,7 +3855,7 @@ static zend_always_inline void php_array_replace_wrapper(INTERNAL_FUNCTION_PARAM
3857
3855
{
3858
3856
zval * args = NULL ;
3859
3857
zval * arg ;
3860
- int argc , i ;
3858
+ uint32_t argc , i ;
3861
3859
HashTable * dest ;
3862
3860
3863
3861
ZEND_PARSE_PARAMETERS_START (1 , -1 )
@@ -3907,7 +3905,7 @@ static zend_always_inline void php_array_merge_wrapper(INTERNAL_FUNCTION_PARAMET
3907
3905
{
3908
3906
zval * args = NULL ;
3909
3907
zval * arg ;
3910
- int argc , i ;
3908
+ uint32_t argc , i ;
3911
3909
zval * src_entry ;
3912
3910
HashTable * src , * dest ;
3913
3911
uint32_t count = 0 ;
@@ -4717,7 +4715,7 @@ static int zval_user_compare(zval *a, zval *b) /* {{{ */
4717
4715
4718
4716
static void php_array_intersect_key (INTERNAL_FUNCTION_PARAMETERS , int data_compare_type ) /* {{{ */
4719
4717
{
4720
- int argc , i ;
4718
+ uint32_t argc , i ;
4721
4719
zval * args ;
4722
4720
int (* intersect_data_compare_func )(zval * , zval * ) = NULL ;
4723
4721
bool ok ;
@@ -4799,7 +4797,8 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
4799
4797
{
4800
4798
zval * args = NULL ;
4801
4799
HashTable * hash ;
4802
- int arr_argc , i , c = 0 ;
4800
+ uint32_t arr_argc , i ;
4801
+ int c = 0 ;
4803
4802
uint32_t idx ;
4804
4803
Bucket * * lists , * list , * * ptrs , * p ;
4805
4804
char * param_spec ;
@@ -5117,7 +5116,7 @@ PHP_FUNCTION(array_uintersect_uassoc)
5117
5116
5118
5117
static void php_array_diff_key (INTERNAL_FUNCTION_PARAMETERS , int data_compare_type ) /* {{{ */
5119
5118
{
5120
- int argc , i ;
5119
+ uint32_t argc , i ;
5121
5120
zval * args ;
5122
5121
int (* diff_data_compare_func )(zval * , zval * ) = NULL ;
5123
5122
bool ok ;
@@ -5194,7 +5193,8 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
5194
5193
{
5195
5194
zval * args = NULL ;
5196
5195
HashTable * hash ;
5197
- int arr_argc , i , c ;
5196
+ uint32_t arr_argc , i ;
5197
+ int c ;
5198
5198
uint32_t idx ;
5199
5199
Bucket * * lists , * list , * * ptrs , * p ;
5200
5200
char * param_spec ;
@@ -5460,7 +5460,7 @@ PHP_FUNCTION(array_diff_ukey)
5460
5460
PHP_FUNCTION (array_diff )
5461
5461
{
5462
5462
zval * args ;
5463
- int argc , i ;
5463
+ uint32_t argc , i ;
5464
5464
uint32_t num ;
5465
5465
HashTable exclude ;
5466
5466
zval * value ;
@@ -5661,15 +5661,15 @@ PHP_FUNCTION(array_multisort)
5661
5661
zval * args ;
5662
5662
zval * * arrays ;
5663
5663
Bucket * * indirect ;
5664
- uint32_t idx ;
5664
+ uint32_t idx ;
5665
5665
HashTable * hash ;
5666
- int argc ;
5667
- int array_size ;
5668
- int num_arrays = 0 ;
5666
+ uint32_t argc ;
5667
+ uint32_t array_size ;
5668
+ uint32_t num_arrays = 0 ;
5669
5669
int parse_state [MULTISORT_LAST ]; /* 0 - flag not allowed 1 - flag allowed */
5670
5670
int sort_order = PHP_SORT_ASC ;
5671
5671
int sort_type = PHP_SORT_REGULAR ;
5672
- int i , k , n ;
5672
+ uint32_t i , k , n ;
5673
5673
bucket_compare_func_t * func ;
5674
5674
5675
5675
ZEND_PARSE_PARAMETERS_START (1 , -1 )
@@ -5755,7 +5755,7 @@ PHP_FUNCTION(array_multisort)
5755
5755
/* Make sure the arrays are of the same size. */
5756
5756
array_size = zend_hash_num_elements (Z_ARRVAL_P (arrays [0 ]));
5757
5757
for (i = 1 ; i < num_arrays ; i ++ ) {
5758
- if (zend_hash_num_elements (Z_ARRVAL_P (arrays [i ])) != ( uint32_t ) array_size ) {
5758
+ if (zend_hash_num_elements (Z_ARRVAL_P (arrays [i ])) != array_size ) {
5759
5759
zend_value_error ("Array sizes are inconsistent" );
5760
5760
MULTISORT_ABORT ;
5761
5761
}
@@ -5815,14 +5815,14 @@ PHP_FUNCTION(array_multisort)
5815
5815
ZVAL_COPY_VALUE (& hash -> arPacked [k ], & indirect [k ][i ].val );
5816
5816
}
5817
5817
} else {
5818
- int repack = 1 ;
5818
+ bool repack = true ;
5819
5819
5820
5820
for (n = 0 , k = 0 ; k < array_size ; k ++ ) {
5821
5821
hash -> arData [k ] = indirect [k ][i ];
5822
5822
if (hash -> arData [k ].key == NULL ) {
5823
5823
hash -> arData [k ].h = n ++ ;
5824
5824
} else {
5825
- repack = 0 ;
5825
+ repack = false ;
5826
5826
}
5827
5827
}
5828
5828
if (repack ) {
0 commit comments