Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavlo Yatsukhnenko <yatsukhnenko@gmail.com>2017-08-11 16:20:40 +0300
committerPavlo Yatsukhnenko <yatsukhnenko@gmail.com>2017-08-11 16:20:40 +0300
commit142b51ded98a7f899bc0c5a93b22a5c04a466642 (patch)
treedc5991bc83523ac12b64c2119b87e7e6f6259f1e /redis_array.c
parent2c8de47f78af8e354bf023ad9a7fb23579e8ba7b (diff)
refactoring
Small change php5 implementation of ZEND_HASH_FOREACH_* macroses. Use ZEND_HASH_FOREACH_VAL in ra_get_key_type. Allocate array via MAKE_STD_ZVAL in HANDLE_MULTI_EXEC macro.
Diffstat (limited to 'redis_array.c')
-rw-r--r--redis_array.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/redis_array.c b/redis_array.c
index d7da7490..311b34bc 100644
--- a/redis_array.c
+++ b/redis_array.c
@@ -814,25 +814,23 @@ PHP_METHOD(RedisArray, select)
#define HANDLE_MULTI_EXEC(ra, cmd) do { \
if (ra && ra->z_multi_exec) { \
int i, num_varargs;\
- zval ***varargs = NULL;\
- zval z_arg_array;\
+ zval ***varargs = NULL, *z_arg_array; \
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O*",\
&object, redis_array_ce, &varargs, &num_varargs) == FAILURE) {\
RETURN_FALSE;\
}\
/* copy all args into a zval hash table */\
- array_init(&z_arg_array);\
+ MAKE_STD_ZVAL(z_arg_array); \
+ array_init(z_arg_array);\
for(i = 0; i < num_varargs; ++i) {\
zval *z_tmp;\
- MAKE_STD_ZVAL(z_tmp);\
- *z_tmp = **varargs[i];\
- zval_copy_ctor(z_tmp);\
- INIT_PZVAL(z_tmp);\
- add_next_index_zval(&z_arg_array, z_tmp);\
+ MAKE_STD_ZVAL(z_tmp); \
+ ZVAL_ZVAL(z_tmp, *varargs[i], 1, 0); \
+ add_next_index_zval(z_arg_array, z_tmp); \
}\
/* call */\
- ra_forward_call(INTERNAL_FUNCTION_PARAM_PASSTHRU, ra, cmd, sizeof(cmd)-1, &z_arg_array, NULL);\
- zval_dtor(&z_arg_array);\
+ ra_forward_call(INTERNAL_FUNCTION_PARAM_PASSTHRU, ra, cmd, sizeof(cmd) - 1, z_arg_array, NULL); \
+ zval_ptr_dtor(&z_arg_array); \
if(varargs) {\
efree(varargs);\
}\