diff options
author | Nicolas Favre-Felix <n.favrefelix@gmail.com> | 2010-05-18 19:04:37 +0400 |
---|---|---|
committer | Nicolas Favre-Felix <n.favrefelix@gmail.com> | 2010-05-18 19:04:37 +0400 |
commit | 6a7277a1ed005354ad723cdb7b3462e8ad474e8c (patch) | |
tree | 8750ffa4fd94ce68803b411dcdce1334ff69ff04 /redis.c | |
parent | 068aca18b232be757e3a0e614d295b02edba587f (diff) |
Almost done, still a slight problem with HGETALL.
Diffstat (limited to 'redis.c')
-rwxr-xr-x | redis.c | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -3589,14 +3589,13 @@ PHP_METHOD(Redis, hGetAll) { REDIS_PROCESS_RESPONSE(redis_sock_read_multibulk_reply_zipped_strings); } -PHPAPI void array_zip_values_and_scores(INTERNAL_FUNCTION_PARAMETERS, int use_atof TSRMLS_DC) { +PHPAPI void array_zip_values_and_scores(zval *z_tab, int use_atof TSRMLS_DC) { zval *z_ret; MAKE_STD_ZVAL(z_ret); - *z_ret = *return_value; /* copy */ - array_init(return_value); + array_init(z_ret); - HashTable *keytable = Z_ARRVAL_P(z_ret); + HashTable *keytable = Z_ARRVAL_P(z_tab); int i = 0; for(zend_hash_internal_pointer_reset(keytable); zend_hash_has_more_elements(keytable) == SUCCESS; @@ -3631,12 +3630,16 @@ PHPAPI void array_zip_values_and_scores(INTERNAL_FUNCTION_PARAMETERS, int use_at hval_len = Z_STRLEN_PP(z_value_pp); if(use_atof) { - add_assoc_double_ex(return_value, hkey, 1+hkey_len, atof(hval)); + add_assoc_double_ex(z_ret, hkey, 1+hkey_len, atof(hval)); } else { - add_assoc_stringl_ex(return_value, hkey, 1+hkey_len, hval, hval_len, 1); + add_assoc_stringl_ex(z_ret, hkey, 1+hkey_len, hval, hval_len, 1); } } - zval_dtor(z_ret); + /* replace */ + zval_dtor(z_tab); + *z_tab = *z_ret; + zval_copy_ctor(z_tab); + efree(z_ret); } |