diff options
author | Pavlo Yatsukhnenko <yatsukhnenko@gmail.com> | 2017-04-27 14:37:13 +0300 |
---|---|---|
committer | Pavlo Yatsukhnenko <yatsukhnenko@gmail.com> | 2017-04-27 17:46:49 +0300 |
commit | 47d3722dec9661b9820c2a9fae3f379998f64a6b (patch) | |
tree | e5b982c2c2e7a1d586ccaf398deab1e33163a159 /redis_array_impl.c | |
parent | 9ec9aedea803ebc7b55fca026f3be69471d0e964 (diff) |
Remove `ra_find_key` + use return_value instead of stack allocated z_tmp in`ra_forward_call`
Diffstat (limited to 'redis_array_impl.c')
-rw-r--r-- | redis_array_impl.c | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/redis_array_impl.c b/redis_array_impl.c index 4918d814..2795491c 100644 --- a/redis_array_impl.c +++ b/redis_array_impl.c @@ -401,6 +401,7 @@ ra_call_extractor(RedisArray *ra, const char *key, int key_len, int *out_len TSR return NULL; } + ZVAL_NULL(&z_ret); /* call extraction function */ ZVAL_STRINGL(&z_argv, key, key_len); call_user_function(EG(function_table), NULL, &ra->z_fun, &z_ret, 1, &z_argv); @@ -448,6 +449,7 @@ ra_call_distributor(RedisArray *ra, const char *key, int key_len, int *pos TSRML return 0; } + ZVAL_NULL(&z_ret); /* call extraction function */ ZVAL_STRINGL(&z_argv, key, key_len); call_user_function(EG(function_table), NULL, &ra->z_dist, &z_ret, 1, &z_argv); @@ -513,24 +515,6 @@ ra_find_node_by_name(RedisArray *ra, const char *host, int host_len TSRMLS_DC) { return NULL; } - -char * -ra_find_key(RedisArray *ra, zval *z_args, const char *cmd, int *key_len) { - - zval *zp_tmp; - int key_pos = 0; /* TODO: change this depending on the command */ - - if (zend_hash_num_elements(Z_ARRVAL_P(z_args)) == 0 || - (zp_tmp = zend_hash_index_find(Z_ARRVAL_P(z_args), key_pos)) == NULL || - Z_TYPE_P(zp_tmp) != IS_STRING - ) { - return NULL; - } - - *key_len = Z_STRLEN_P(zp_tmp); - return Z_STRVAL_P(zp_tmp); -} - void ra_index_multi(zval *z_redis, long multi_value TSRMLS_DC) { |