@@ -1220,7 +1220,7 @@ static void array_zip_values_and_scores(RedisSock *redis_sock, zval *z_tab,
1220
1220
unsigned long idx ;
1221
1221
zval * z_key_p , * z_value_p ;
1222
1222
1223
- zend_hash_get_current_key_ex (keytable , & tablekey , & idx , 0 );
1223
+ zend_hash_get_current_key (keytable , & tablekey , & idx );
1224
1224
if ((z_key_p = zend_hash_get_current_data (keytable )) == NULL ) {
1225
1225
continue ; /* this should never happen, according to the PHP people. */
1226
1226
}
@@ -1234,7 +1234,7 @@ static void array_zip_values_and_scores(RedisSock *redis_sock, zval *z_tab,
1234
1234
zend_hash_move_forward (keytable );
1235
1235
1236
1236
/* fetch again */
1237
- zend_hash_get_current_key_ex (keytable , & tablekey , & idx , 0 );
1237
+ zend_hash_get_current_key (keytable , & tablekey , & idx );
1238
1238
if ((z_value_p = zend_hash_get_current_data (keytable )) == NULL ) {
1239
1239
continue ; /* this should never happen, according to the PHP people. */
1240
1240
}
@@ -1244,13 +1244,13 @@ static void array_zip_values_and_scores(RedisSock *redis_sock, zval *z_tab,
1244
1244
1245
1245
/* Decode the score depending on flag */
1246
1246
if (decode == SCORE_DECODE_INT && Z_STRLEN_P (z_value_p ) > 0 ) {
1247
- add_assoc_long_ex (& z_ret , hkey , 1 + hkey_len , atoi (hval + 1 ));
1247
+ add_assoc_long_ex (& z_ret , hkey , hkey_len , atoi (hval + 1 ));
1248
1248
} else if (decode == SCORE_DECODE_DOUBLE ) {
1249
- add_assoc_double_ex (& z_ret , hkey , 1 + hkey_len , atof (hval ));
1249
+ add_assoc_double_ex (& z_ret , hkey , hkey_len , atof (hval ));
1250
1250
} else {
1251
1251
zval z ;
1252
1252
ZVAL_DUP (& z , z_value_p );
1253
- add_assoc_zval_ex (& z_ret , hkey , 1 + hkey_len , & z );
1253
+ add_assoc_zval_ex (& z_ret , hkey , hkey_len , & z );
1254
1254
}
1255
1255
}
1256
1256
@@ -1391,12 +1391,12 @@ PHP_REDIS_API void redis_string_response(INTERNAL_FUNCTION_PARAMETERS, RedisSock
1391
1391
RETURN_FALSE ;
1392
1392
}
1393
1393
IF_MULTI_OR_PIPELINE () {
1394
- zval * z = NULL ;
1395
- if ( redis_unserialize ( redis_sock , response , response_len ,
1396
- & z TSRMLS_CC ) == 1 )
1394
+ zval z , * z_p ;
1395
+ z_p = & z ;
1396
+ if ( redis_unserialize ( redis_sock , response , response_len , & z_p ) == 1 )
1397
1397
{
1398
1398
efree (response );
1399
- add_next_index_zval (z_tab , z );
1399
+ add_next_index_zval (z_tab , z_p );
1400
1400
} else {
1401
1401
add_next_index_stringl (z_tab , response , response_len );
1402
1402
}
@@ -1432,9 +1432,8 @@ redis_ping_response(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
1432
1432
IF_MULTI_OR_PIPELINE () {
1433
1433
add_next_index_stringl (z_tab , response , response_len );
1434
1434
} else {
1435
- RETURN_STRINGL (response , response_len );
1435
+ RETURN_STRING (response );
1436
1436
}
1437
- efree (response );
1438
1437
}
1439
1438
1440
1439
/* Response for DEBUG object which is a formatted single line reply */
@@ -1852,7 +1851,8 @@ redis_mbulk_reply_loop(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
1852
1851
while (count > 0 ) {
1853
1852
line = redis_sock_read (redis_sock , & len TSRMLS_CC );
1854
1853
if (line != NULL ) {
1855
- zval * z = NULL ;
1854
+ zval z , * z_p ;
1855
+ z_p = & z ;
1856
1856
int unwrap ;
1857
1857
1858
1858
/* We will attempt unserialization, if we're unserializing everything,
@@ -1862,9 +1862,9 @@ redis_mbulk_reply_loop(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
1862
1862
(unserialize == UNSERIALIZE_KEYS && count % 2 == 0 ) ||
1863
1863
(unserialize == UNSERIALIZE_VALS && count % 2 != 0 );
1864
1864
1865
- if (unwrap && redis_unserialize (redis_sock , line , len , & z TSRMLS_CC )) {
1865
+ if (unwrap && redis_unserialize (redis_sock , line , len , & z_p TSRMLS_CC )) {
1866
1866
efree (line );
1867
- add_next_index_zval (z_tab , z );
1867
+ add_next_index_zval (z_tab , z_p );
1868
1868
} else {
1869
1869
add_next_index_stringl (z_tab , line , len );
1870
1870
}
@@ -1885,7 +1885,7 @@ PHP_REDIS_API int redis_mbulk_reply_assoc(INTERNAL_FUNCTION_PARAMETERS, RedisSoc
1885
1885
int i , numElems ;
1886
1886
zval z_multi_result ;
1887
1887
1888
- zval * * z_keys = ctx ;
1888
+ zval * z_keys = ctx ;
1889
1889
1890
1890
if (-1 == redis_check_eof (redis_sock , 0 TSRMLS_CC )) {
1891
1891
return -1 ;
@@ -1914,19 +1914,19 @@ PHP_REDIS_API int redis_mbulk_reply_assoc(INTERNAL_FUNCTION_PARAMETERS, RedisSoc
1914
1914
for (i = 0 ; i < numElems ; ++ i ) {
1915
1915
response = redis_sock_read (redis_sock , & response_len TSRMLS_CC );
1916
1916
if (response != NULL ) {
1917
- zval * z = NULL ;
1918
- if (redis_unserialize (redis_sock , response , response_len , & z TSRMLS_CC ) == 1 ) {
1917
+ zval z , * z_p ;
1918
+ z_p = & z ;
1919
+ if (redis_unserialize (redis_sock , response , response_len , & z_p ) == 1 ) {
1919
1920
efree (response );
1920
- add_assoc_zval_ex (& z_multi_result , Z_STRVAL_P (z_keys [i ]), 1 + Z_STRLEN_P (z_keys [i ]), z );
1921
+ add_assoc_zval_ex (& z_multi_result , Z_STRVAL (z_keys [i ]), Z_STRLEN (z_keys [i ]), z_p );
1921
1922
} else {
1922
- add_assoc_stringl_ex (& z_multi_result , Z_STRVAL_P (z_keys [i ]), 1 + Z_STRLEN_P (z_keys [i ]), response , response_len );
1923
+ add_assoc_stringl_ex (& z_multi_result , Z_STRVAL (z_keys [i ]), Z_STRLEN (z_keys [i ]), response , response_len );
1923
1924
}
1924
1925
} else {
1925
- add_assoc_bool_ex (& z_multi_result , Z_STRVAL_P (z_keys [i ]), 1 + Z_STRLEN_P (z_keys [i ]), 0 );
1926
+ add_assoc_bool_ex (& z_multi_result , Z_STRVAL (z_keys [i ]), Z_STRLEN (z_keys [i ]), 0 );
1926
1927
}
1927
- zval_dtor (z_keys [i ]);
1928
- efree (z_keys [i ]);
1929
- }
1928
+ zval_dtor (& z_keys [i ]);
1929
+ }
1930
1930
efree (z_keys );
1931
1931
1932
1932
IF_MULTI_OR_PIPELINE () {
@@ -2018,7 +2018,7 @@ redis_serialize(RedisSock *redis_sock, zval *z, char **val, int *val_len
2018
2018
convert_to_string (& z_copy );
2019
2019
* val = Z_STRVAL_P (& z_copy );
2020
2020
* val_len = Z_STRLEN_P (& z_copy );
2021
- return 1 ;
2021
+ return 0 ;
2022
2022
2023
2023
case REDIS_SERIALIZER_PHP :
2024
2024
@@ -2028,14 +2028,14 @@ redis_serialize(RedisSock *redis_sock, zval *z, char **val, int *val_len
2028
2028
* val_len = sstr .s -> len ;
2029
2029
PHP_VAR_SERIALIZE_DESTROY (ht );
2030
2030
2031
- return 1 ;
2031
+ return 0 ;
2032
2032
2033
2033
case REDIS_SERIALIZER_IGBINARY :
2034
2034
#ifdef HAVE_REDIS_IGBINARY
2035
2035
if (igbinary_serialize (& val8 , (size_t * )& sz , z TSRMLS_CC ) == 0 ) {
2036
2036
* val = (char * )val8 ;
2037
2037
* val_len = (int )sz ;
2038
- return 1 ;
2038
+ return 0 ;
2039
2039
}
2040
2040
#endif
2041
2041
return 0 ;
@@ -2056,16 +2056,7 @@ redis_unserialize(RedisSock* redis_sock, const char *val, int val_len,
2056
2056
return 0 ;
2057
2057
2058
2058
case REDIS_SERIALIZER_PHP :
2059
- if (!* return_value ) {
2060
- // TODO Sean-Der, heap allocation
2061
- //MAKE_STD_ZVAL(*return_value);
2062
- rv_free = 1 ;
2063
- }
2064
- #if ZEND_MODULE_API_NO >= 20100000
2065
2059
PHP_VAR_UNSERIALIZE_INIT (var_hash );
2066
- #else
2067
- memset (& var_hash , 0 , sizeof (var_hash ));
2068
- #endif
2069
2060
if (!php_var_unserialize (* return_value , (const unsigned char * * )& val ,
2070
2061
(const unsigned char * )val + val_len , & var_hash TSRMLS_CC )) {
2071
2062
if (rv_free == 1 ) efree (* return_value );
@@ -2356,7 +2347,6 @@ redis_read_variant_reply(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
2356
2347
/* Set our return value */
2357
2348
ZVAL_DUP (return_value , z_ret_p );
2358
2349
zval_dtor (z_ret_p );
2359
- efree (z_ret_p );
2360
2350
}
2361
2351
2362
2352
/* Success */
0 commit comments