@@ -829,7 +829,7 @@ PHP_METHOD(RedisArray, mget)
829
829
RedisArray * ra ;
830
830
int * pos , argc , * argc_each ;
831
831
HashTable * h_keys ;
832
- zval * * redis_instances , * * argv ;
832
+ zval * * argv ;
833
833
834
834
/* Multi/exec support */
835
835
HANDLE_MULTI_EXEC ("MGET" );
@@ -851,7 +851,6 @@ PHP_METHOD(RedisArray, mget)
851
851
argc = zend_hash_num_elements (h_keys );
852
852
pos = emalloc (argc * sizeof (int ));
853
853
854
- redis_instances = ecalloc (argc , sizeof (zval * ));
855
854
argv = emalloc (argc * sizeof (zval * ));
856
855
857
856
argc_each = emalloc (ra -> count * sizeof (int ));
@@ -869,7 +868,6 @@ PHP_METHOD(RedisArray, mget)
869
868
php_error_docref (NULL TSRMLS_CC , E_ERROR , "MGET: all keys must be strings or longs" );
870
869
efree (argv );
871
870
efree (pos );
872
- efree (redis_instances );
873
871
efree (argc_each );
874
872
RETURN_FALSE ;
875
873
}
@@ -884,7 +882,9 @@ PHP_METHOD(RedisArray, mget)
884
882
}
885
883
886
884
/* Find our node */
887
- redis_instances [i ] = ra_find_node (ra , key_lookup , key_len , & pos [i ] TSRMLS_CC );
885
+ if (ra_find_node (ra , key_lookup , key_len , & pos [i ] TSRMLS_CC ) == NULL ) {
886
+ /* TODO: handle */
887
+ }
888
888
889
889
argc_each [pos [i ]]++ ; /* count number of keys per node */
890
890
argv [i ] = data ;
@@ -925,7 +925,6 @@ PHP_METHOD(RedisArray, mget)
925
925
zval_dtor (& z_fun );
926
926
zval_ptr_dtor (& z_tmp_array );
927
927
efree (pos );
928
- efree (redis_instances );
929
928
efree (argc_each );
930
929
931
930
/* failure */
@@ -958,7 +957,6 @@ PHP_METHOD(RedisArray, mget)
958
957
zval_dtor (& z_fun );
959
958
efree (argv );
960
959
efree (pos );
961
- efree (redis_instances );
962
960
efree (argc_each );
963
961
}
964
962
@@ -970,7 +968,7 @@ PHP_METHOD(RedisArray, mset)
970
968
RedisArray * ra ;
971
969
int * pos , argc , * argc_each ;
972
970
HashTable * h_keys ;
973
- zval * redis_inst , * * redis_instances , * * argv ;
971
+ zval * redis_inst , * * argv ;
974
972
char * key , * * keys , * * key_free , kbuf [40 ];
975
973
zend_string * key_zstr ;
976
974
unsigned int key_len ;
@@ -998,7 +996,6 @@ PHP_METHOD(RedisArray, mset)
998
996
key_lens = emalloc (argc * sizeof (int ));
999
997
1000
998
argv = emalloc (argc * sizeof (zval * ));
1001
- redis_instances = ecalloc (argc , sizeof (zval * ));
1002
999
1003
1000
/* Allocate an array holding the indexes of any keys that need freeing */
1004
1001
key_free = emalloc (argc * sizeof (char * ));
@@ -1029,7 +1026,9 @@ PHP_METHOD(RedisArray, mset)
1029
1026
key = key_zstr -> val ;
1030
1027
}
1031
1028
1032
- redis_instances [i ] = ra_find_node (ra , key , (int )key_len , & pos [i ] TSRMLS_CC );
1029
+ if (ra_find_node (ra , key , (int )key_len , & pos [i ] TSRMLS_CC ) == NULL ) {
1030
+ /* TODO: handle */
1031
+ }
1033
1032
argc_each [pos [i ]]++ ; /* count number of keys per node */
1034
1033
argv [i ] = data ;
1035
1034
keys [i ] = key ;
@@ -1095,7 +1094,6 @@ PHP_METHOD(RedisArray, mset)
1095
1094
efree (key_lens );
1096
1095
efree (argv );
1097
1096
efree (pos );
1098
- efree (redis_instances );
1099
1097
efree (argc_each );
1100
1098
1101
1099
RETURN_TRUE ;
@@ -1109,7 +1107,7 @@ PHP_METHOD(RedisArray, del)
1109
1107
RedisArray * ra ;
1110
1108
int * pos , argc , * argc_each ;
1111
1109
HashTable * h_keys ;
1112
- zval * redis_inst , * * redis_instances , * * argv ;;
1110
+ zval * redis_inst , * * argv ;;
1113
1111
long total = 0 ;
1114
1112
int free_zkeys = 0 ;
1115
1113
@@ -1152,7 +1150,6 @@ PHP_METHOD(RedisArray, del)
1152
1150
pos = emalloc (argc * sizeof (int ));
1153
1151
1154
1152
argv = emalloc (argc * sizeof (zval * ));
1155
- redis_instances = ecalloc (argc , sizeof (zval * ));
1156
1153
1157
1154
argc_each = emalloc (ra -> count * sizeof (int ));
1158
1155
memset (argc_each , 0 , ra -> count * sizeof (int ));
@@ -1166,7 +1163,9 @@ PHP_METHOD(RedisArray, del)
1166
1163
RETURN_FALSE ;
1167
1164
}
1168
1165
1169
- redis_instances [i ] = ra_find_node (ra , Z_STRVAL_P (data ), Z_STRLEN_P (data ), & pos [i ] TSRMLS_CC );
1166
+ if (ra_find_node (ra , Z_STRVAL_P (data ), Z_STRLEN_P (data ), & pos [i ] TSRMLS_CC ) == NULL ) {
1167
+ /* TODO: handle */
1168
+ }
1170
1169
argc_each [pos [i ]]++ ; /* count number of keys per node */
1171
1170
argv [i ] = data ;
1172
1171
i ++ ;
@@ -1218,7 +1217,6 @@ PHP_METHOD(RedisArray, del)
1218
1217
/* cleanup */
1219
1218
efree (argv );
1220
1219
efree (pos );
1221
- efree (redis_instances );
1222
1220
efree (argc_each );
1223
1221
1224
1222
if (free_zkeys ) {
@@ -1327,4 +1325,4 @@ PHP_METHOD(RedisArray, unwatch)
1327
1325
ra_index_unwatch (ra -> z_multi_exec , return_value TSRMLS_CC );
1328
1326
}
1329
1327
1330
- /* vim: set tabstop=4 softtabstop=4 noexpandtab shiftwidth=4: */
1328
+ /* vim: set tabstop=4 softtabstop=4 expandtab shiftwidth=4: */
0 commit comments