@@ -2270,12 +2270,12 @@ PHP_METHOD(Redis, sMembers)
2270
2270
PHPAPI int generic_multiple_args_cmd (INTERNAL_FUNCTION_PARAMETERS , char * keyword , int keyword_len ,
2271
2271
int min_argc , RedisSock * * out_sock , int has_timeout , int all_keys , int can_serialize )
2272
2272
{
2273
- zval * object , * * z_args , * z_array ;
2273
+ zval * * z_args , * z_array ;
2274
2274
char * * keys , * cmd ;
2275
2275
int cmd_len , * keys_len , * keys_to_free ;
2276
2276
int i , j , argc = ZEND_NUM_ARGS (), real_argc = 0 ;
2277
2277
int single_array = 0 ;
2278
- int timeout ;
2278
+ int timeout = 0 ;
2279
2279
int pos ;
2280
2280
int array_size ;
2281
2281
@@ -2347,10 +2347,9 @@ PHPAPI int generic_multiple_args_cmd(INTERNAL_FUNCTION_PARAMETERS, char *keyword
2347
2347
char * key ;
2348
2348
unsigned int key_len ;
2349
2349
unsigned long idx ;
2350
- int type ;
2351
2350
zval * * z_value_pp ;
2352
2351
2353
- type = zend_hash_get_current_key_ex (keytable , & key , & key_len , & idx , 0 , NULL );
2352
+ zend_hash_get_current_key_ex (keytable , & key , & key_len , & idx , 0 , NULL );
2354
2353
if (zend_hash_get_current_data (keytable , (void * * )& z_value_pp ) == FAILURE ) {
2355
2354
continue ; /* this should never happen, according to the PHP people. */
2356
2355
}
@@ -2392,12 +2391,7 @@ PHPAPI int generic_multiple_args_cmd(INTERNAL_FUNCTION_PARAMETERS, char *keyword
2392
2391
real_argc ++ ;
2393
2392
}
2394
2393
} else {
2395
- int nb_keys ;
2396
- if (!has_timeout ) {
2397
- nb_keys = argc ;
2398
- } else if (has_timeout && Z_TYPE_P (z_args [argc - 1 ]) == IS_LONG ) {
2399
- nb_keys = argc - 1 ;
2400
- } else {
2394
+ if (has_timeout && Z_TYPE_P (z_args [argc - 1 ]) != IS_LONG ) {
2401
2395
php_error_docref (NULL TSRMLS_CC , E_ERROR , "Syntax error on timeout" );
2402
2396
}
2403
2397
@@ -2465,7 +2459,6 @@ PHPAPI int generic_multiple_args_cmd(INTERNAL_FUNCTION_PARAMETERS, char *keyword
2465
2459
2466
2460
if (z_args ) efree (z_args );
2467
2461
2468
- object = getThis ();
2469
2462
/*
2470
2463
cmd[cmd_len] = 0;
2471
2464
php_printf("cmd=[%s]\n", cmd);
@@ -2703,10 +2696,9 @@ PHP_METHOD(Redis, sort) {
2703
2696
char * key ;
2704
2697
unsigned int key_len ;
2705
2698
unsigned long idx ;
2706
- int type ;
2707
2699
zval * * z_value_pp ;
2708
2700
2709
- type = zend_hash_get_current_key_ex (keytable , & key , & key_len , & idx , 0 , NULL );
2701
+ zend_hash_get_current_key_ex (keytable , & key , & key_len , & idx , 0 , NULL );
2710
2702
if (zend_hash_get_current_data (keytable , (void * * )& z_value_pp ) == FAILURE ) {
2711
2703
continue ; /* this should never happen, according to the PHP people. */
2712
2704
}
@@ -3441,7 +3433,7 @@ generic_mset(INTERNAL_FUNCTION_PARAMETERS, char *kw, void (*fun)(INTERNAL_FUNCTI
3441
3433
zval * object ;
3442
3434
RedisSock * redis_sock ;
3443
3435
3444
- char * cmd , * p ;
3436
+ char * cmd = NULL , * p = NULL ;
3445
3437
int cmd_len = 0 , argc = 0 , kw_len = strlen (kw );
3446
3438
int step = 0 ; // 0: compute size; 1: copy strings.
3447
3439
zval * z_array ;
@@ -4205,7 +4197,7 @@ PHP_METHOD(Redis, zIncrBy)
4205
4197
PHPAPI void generic_z_command (INTERNAL_FUNCTION_PARAMETERS , char * command , int command_len ) {
4206
4198
4207
4199
zval * object , * keys_array , * weights_array = NULL , * * data ;
4208
- HashTable * arr_weights_hash , * arr_keys_hash ;
4200
+ HashTable * arr_weights_hash = NULL , * arr_keys_hash ;
4209
4201
int key_output_len , array_weights_count , array_keys_count , operation_len = 0 ;
4210
4202
char * key_output , * operation ;
4211
4203
RedisSock * redis_sock ;
@@ -4655,12 +4647,11 @@ PHPAPI void array_zip_values_and_scores(RedisSock *redis_sock, zval *z_tab, int
4655
4647
4656
4648
char * tablekey , * hkey , * hval ;
4657
4649
unsigned int tablekey_len ;
4658
- int hkey_len , hval_len ;
4650
+ int hkey_len ;
4659
4651
unsigned long idx ;
4660
- int type ;
4661
4652
zval * * z_key_pp , * * z_value_pp ;
4662
4653
4663
- type = zend_hash_get_current_key_ex (keytable , & tablekey , & tablekey_len , & idx , 0 , NULL );
4654
+ zend_hash_get_current_key_ex (keytable , & tablekey , & tablekey_len , & idx , 0 , NULL );
4664
4655
if (zend_hash_get_current_data (keytable , (void * * )& z_key_pp ) == FAILURE ) {
4665
4656
continue ; /* this should never happen, according to the PHP people. */
4666
4657
}
@@ -4674,14 +4665,13 @@ PHPAPI void array_zip_values_and_scores(RedisSock *redis_sock, zval *z_tab, int
4674
4665
zend_hash_move_forward (keytable );
4675
4666
4676
4667
/* fetch again */
4677
- type = zend_hash_get_current_key_ex (keytable , & tablekey , & tablekey_len , & idx , 0 , NULL );
4668
+ zend_hash_get_current_key_ex (keytable , & tablekey , & tablekey_len , & idx , 0 , NULL );
4678
4669
if (zend_hash_get_current_data (keytable , (void * * )& z_value_pp ) == FAILURE ) {
4679
4670
continue ; /* this should never happen, according to the PHP people. */
4680
4671
}
4681
4672
4682
4673
/* get current value, a hash value now. */
4683
4674
hval = Z_STRVAL_PP (z_value_pp );
4684
- hval_len = Z_STRLEN_PP (z_value_pp );
4685
4675
4686
4676
if (use_atof ) { /* zipping a score */
4687
4677
add_assoc_double_ex (z_ret , hkey , 1 + hkey_len , atof (hval ));
@@ -5298,10 +5288,9 @@ PHP_METHOD(Redis, subscribe)
5298
5288
zval * z_tab , * * tmp ;
5299
5289
char * type_response ;
5300
5290
5301
- int callback_type ;
5302
- zval * z_o , * z_fun ,* z_ret , * z_args [3 ];
5291
+ int callback_type = 0 ;
5292
+ zval * z_o , * z_fun = NULL ,* z_ret , * z_args [3 ];
5303
5293
char * method_name ;
5304
- zend_class_entry * ce ;
5305
5294
5306
5295
if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Oaz|z" ,
5307
5296
& object , redis_ce , & array , & z_callback ) == FAILURE ) {
@@ -5387,6 +5376,8 @@ PHP_METHOD(Redis, subscribe)
5387
5376
callback_ft_name = Z_STRVAL_P (z_callback );
5388
5377
callback_ft_name_len = strlen (callback_ft_name );
5389
5378
callback_type = R_SUB_CALLBACK_FT_TYPE ;
5379
+ MAKE_STD_ZVAL (z_fun );
5380
+ ZVAL_STRINGL (z_fun , callback_ft_name , callback_ft_name_len , 0 );
5390
5381
}
5391
5382
5392
5383
/* Multibulk Response, format : {message type, originating channel, message payload} */
@@ -5421,14 +5412,12 @@ PHP_METHOD(Redis, subscribe)
5421
5412
switch (callback_type ) {
5422
5413
case R_SUB_CALLBACK_CLASS_TYPE :
5423
5414
MAKE_STD_ZVAL (z_ret );
5424
- call_user_function (& ce -> function_table , & z_o , z_fun , z_ret , 3 , z_args TSRMLS_CC );
5415
+ call_user_function (& redis_ce -> function_table , & z_o , z_fun , z_ret , 3 , z_args TSRMLS_CC );
5425
5416
efree (z_ret );
5426
5417
break ;
5427
5418
5428
5419
case R_SUB_CALLBACK_FT_TYPE :
5429
5420
MAKE_STD_ZVAL (z_ret );
5430
- MAKE_STD_ZVAL (z_fun );
5431
- ZVAL_STRINGL (z_fun , callback_ft_name , callback_ft_name_len , 0 );
5432
5421
call_user_function (EG (function_table ), NULL , z_fun , z_ret , 3 , z_args TSRMLS_CC );
5433
5422
efree (z_fun );
5434
5423
efree (z_ret );
0 commit comments