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:
authorRemi Collet <remi@remirepo.net>2019-07-09 16:26:44 +0300
committerRemi Collet <remi@remirepo.net>2019-07-09 16:26:44 +0300
commit943802272a9557c513eb6b59f285e175ec734ad4 (patch)
treeb2043f3d762d36fd986a8b7bb75a2976d22cfd1a /redis_array_impl.c
parent28388abceeb217202eb48c6edb5fd8671d46068e (diff)
cleanup TSRMLS_* usage
Diffstat (limited to 'redis_array_impl.c')
-rw-r--r--redis_array_impl.c208
1 files changed, 104 insertions, 104 deletions
diff --git a/redis_array_impl.c b/redis_array_impl.c
index 153368d5..54ae5002 100644
--- a/redis_array_impl.c
+++ b/redis_array_impl.c
@@ -33,7 +33,7 @@
extern zend_class_entry *redis_ce;
static RedisArray *
-ra_load_hosts(RedisArray *ra, HashTable *hosts, zend_string *auth, long retry_interval, zend_bool b_lazy_connect TSRMLS_DC)
+ra_load_hosts(RedisArray *ra, HashTable *hosts, zend_string *auth, long retry_interval, zend_bool b_lazy_connect)
{
int i = 0, host_len;
char *host, *p;
@@ -80,7 +80,7 @@ ra_load_hosts(RedisArray *ra, HashTable *hosts, zend_string *auth, long retry_in
if (!b_lazy_connect)
{
/* connect */
- if (redis_sock_server_open(redis->sock TSRMLS_CC) < 0 || (auth && redis_sock_auth(redis->sock TSRMLS_CC) < 0)) {
+ if (redis_sock_server_open(redis->sock) < 0 || (auth && redis_sock_auth(redis->sock ) < 0)) {
zval_dtor(&z_cons);
ra->count = ++i;
return NULL;
@@ -162,7 +162,7 @@ ra_find_name(const char *name) {
}
/* laod array from INI settings */
-RedisArray *ra_load_array(const char *name TSRMLS_DC) {
+RedisArray *ra_load_array(const char *name) {
zval *z_data, z_fun, z_dist;
zval z_params_hosts;
@@ -197,7 +197,7 @@ RedisArray *ra_load_array(const char *name TSRMLS_DC) {
/* find hosts */
array_init(&z_params_hosts);
if ((iptr = INI_STR("redis.arrays.hosts")) != NULL) {
- sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_hosts TSRMLS_CC);
+ sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_hosts);
}
if ((z_data = zend_hash_str_find(Z_ARRVAL(z_params_hosts), name, name_len)) != NULL) {
hHosts = Z_ARRVAL_P(z_data);
@@ -206,7 +206,7 @@ RedisArray *ra_load_array(const char *name TSRMLS_DC) {
/* find previous hosts */
array_init(&z_params_prev);
if ((iptr = INI_STR("redis.arrays.previous")) != NULL) {
- sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_prev TSRMLS_CC);
+ sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_prev);
}
if ((z_data = zend_hash_str_find(Z_ARRVAL(z_params_prev), name, name_len)) != NULL) {
hPrev = Z_ARRVAL_P(z_data);
@@ -215,7 +215,7 @@ RedisArray *ra_load_array(const char *name TSRMLS_DC) {
/* find function */
array_init(&z_params_funs);
if ((iptr = INI_STR("redis.arrays.functions")) != NULL) {
- sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_funs TSRMLS_CC);
+ sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_funs);
}
ZVAL_NULL(&z_fun);
if ((z_data = zend_hash_str_find(Z_ARRVAL(z_params_funs), name, name_len)) != NULL) {
@@ -225,7 +225,7 @@ RedisArray *ra_load_array(const char *name TSRMLS_DC) {
/* find distributor */
array_init(&z_params_dist);
if ((iptr = INI_STR("redis.arrays.distributor")) != NULL) {
- sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_dist TSRMLS_CC);
+ sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_dist);
}
ZVAL_NULL(&z_dist);
if ((z_data = zend_hash_str_find(Z_ARRVAL(z_params_dist), name, name_len)) != NULL) {
@@ -235,7 +235,7 @@ RedisArray *ra_load_array(const char *name TSRMLS_DC) {
/* find hash algorithm */
array_init(&z_params_algo);
if ((iptr = INI_STR("redis.arrays.algorithm")) != NULL) {
- sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_algo TSRMLS_CC);
+ sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_algo);
}
if ((z_data = zend_hash_str_find(Z_ARRVAL(z_params_algo), name, name_len)) != NULL) {
algorithm = zval_get_string(z_data);
@@ -244,7 +244,7 @@ RedisArray *ra_load_array(const char *name TSRMLS_DC) {
/* find index option */
array_init(&z_params_index);
if ((iptr = INI_STR("redis.arrays.index")) != NULL) {
- sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_index TSRMLS_CC);
+ sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_index);
}
if ((z_data = zend_hash_str_find(Z_ARRVAL(z_params_index), name, name_len)) != NULL) {
if (Z_TYPE_P(z_data) == IS_STRING && strncmp(Z_STRVAL_P(z_data), "1", 1) == 0) {
@@ -255,7 +255,7 @@ RedisArray *ra_load_array(const char *name TSRMLS_DC) {
/* find autorehash option */
array_init(&z_params_autorehash);
if ((iptr = INI_STR("redis.arrays.autorehash")) != NULL) {
- sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_autorehash TSRMLS_CC);
+ sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_autorehash);
}
if ((z_data = zend_hash_str_find(Z_ARRVAL(z_params_autorehash), name, name_len)) != NULL) {
if(Z_TYPE_P(z_data) == IS_STRING && strncmp(Z_STRVAL_P(z_data), "1", 1) == 0) {
@@ -266,7 +266,7 @@ RedisArray *ra_load_array(const char *name TSRMLS_DC) {
/* find retry interval option */
array_init(&z_params_retry_interval);
if ((iptr = INI_STR("redis.arrays.retryinterval")) != NULL) {
- sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_retry_interval TSRMLS_CC);
+ sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_retry_interval);
}
if ((z_data = zend_hash_str_find(Z_ARRVAL(z_params_retry_interval), name, name_len)) != NULL) {
if (Z_TYPE_P(z_data) == IS_LONG) {
@@ -279,7 +279,7 @@ RedisArray *ra_load_array(const char *name TSRMLS_DC) {
/* find pconnect option */
array_init(&z_params_pconnect);
if ((iptr = INI_STR("redis.arrays.pconnect")) != NULL) {
- sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_pconnect TSRMLS_CC);
+ sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_pconnect);
}
if ((z_data = zend_hash_str_find(Z_ARRVAL(z_params_pconnect), name, name_len)) != NULL) {
if(Z_TYPE_P(z_data) == IS_STRING && strncmp(Z_STRVAL_P(z_data), "1", 1) == 0) {
@@ -290,7 +290,7 @@ RedisArray *ra_load_array(const char *name TSRMLS_DC) {
/* find lazy connect option */
array_init(&z_params_lazy_connect);
if ((iptr = INI_STR("redis.arrays.lazyconnect")) != NULL) {
- sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_lazy_connect TSRMLS_CC);
+ sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_lazy_connect);
}
if ((z_data = zend_hash_str_find(Z_ARRVAL(z_params_lazy_connect), name, name_len)) != NULL) {
if (Z_TYPE_P(z_data) == IS_STRING && strncmp(Z_STRVAL_P(z_data), "1", 1) == 0) {
@@ -301,7 +301,7 @@ RedisArray *ra_load_array(const char *name TSRMLS_DC) {
/* find connect timeout option */
array_init(&z_params_connect_timeout);
if ((iptr = INI_STR("redis.arrays.connecttimeout")) != NULL) {
- sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_connect_timeout TSRMLS_CC);
+ sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_connect_timeout);
}
if ((z_data = zend_hash_str_find(Z_ARRVAL(z_params_connect_timeout), name, name_len)) != NULL) {
if (Z_TYPE_P(z_data) == IS_DOUBLE) {
@@ -316,7 +316,7 @@ RedisArray *ra_load_array(const char *name TSRMLS_DC) {
/* find read timeout option */
array_init(&z_params_read_timeout);
if ((iptr = INI_STR("redis.arrays.readtimeout")) != NULL) {
- sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_read_timeout TSRMLS_CC);
+ sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_read_timeout);
}
if ((z_data = zend_hash_str_find(Z_ARRVAL(z_params_read_timeout), name, name_len)) != NULL) {
if (Z_TYPE_P(z_data) == IS_DOUBLE) {
@@ -331,7 +331,7 @@ RedisArray *ra_load_array(const char *name TSRMLS_DC) {
/* find consistent option */
array_init(&z_params_consistent);
if ((iptr = INI_STR("redis.arrays.consistent")) != NULL) {
- sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_consistent TSRMLS_CC);
+ sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_consistent);
}
if ((z_data = zend_hash_str_find(Z_ARRVAL(z_params_consistent), name, name_len)) != NULL) {
if (Z_TYPE_P(z_data) == IS_STRING && strncmp(Z_STRVAL_P(z_data), "1", 1) == 0) {
@@ -342,14 +342,14 @@ RedisArray *ra_load_array(const char *name TSRMLS_DC) {
/* find auth option */
array_init(&z_params_auth);
if ((iptr = INI_STR("redis.arrays.auth")) != NULL) {
- sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_auth TSRMLS_CC);
+ sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_auth);
}
if ((z_data = zend_hash_str_find(Z_ARRVAL(z_params_auth), name, name_len)) != NULL) {
auth = zval_get_string(z_data);
}
/* create RedisArray object */
- ra = ra_make_array(hHosts, &z_fun, &z_dist, hPrev, b_index, b_pconnect, l_retry_interval, b_lazy_connect, d_connect_timeout, read_timeout, consistent, algorithm, auth TSRMLS_CC);
+ ra = ra_make_array(hHosts, &z_fun, &z_dist, hPrev, b_index, b_pconnect, l_retry_interval, b_lazy_connect, d_connect_timeout, read_timeout, consistent, algorithm, auth);
if (ra) {
ra->auto_rehash = b_autorehash;
if(ra->prev) ra->prev->auto_rehash = b_autorehash;
@@ -420,7 +420,7 @@ ra_make_continuum(zend_string **hosts, int nb_hosts)
}
RedisArray *
-ra_make_array(HashTable *hosts, zval *z_fun, zval *z_dist, HashTable *hosts_prev, zend_bool b_index, zend_bool b_pconnect, long retry_interval, zend_bool b_lazy_connect, double connect_timeout, double read_timeout, zend_bool consistent, zend_string *algorithm, zend_string *auth TSRMLS_DC)
+ra_make_array(HashTable *hosts, zval *z_fun, zval *z_dist, HashTable *hosts_prev, zend_bool b_index, zend_bool b_pconnect, long retry_interval, zend_bool b_lazy_connect, double connect_timeout, double read_timeout, zend_bool consistent, zend_string *algorithm, zend_string *auth)
{
int i, count;
RedisArray *ra;
@@ -441,7 +441,7 @@ ra_make_array(HashTable *hosts, zval *z_fun, zval *z_dist, HashTable *hosts_prev
ra->continuum = NULL;
ra->algorithm = NULL;
- if (ra_load_hosts(ra, hosts, auth, retry_interval, b_lazy_connect TSRMLS_CC) == NULL || !ra->count) {
+ if (ra_load_hosts(ra, hosts, auth, retry_interval, b_lazy_connect) == NULL || !ra->count) {
for (i = 0; i < ra->count; ++i) {
zval_dtor(&ra->redis[i]);
zend_string_release(ra->hosts[i]);
@@ -451,7 +451,7 @@ ra_make_array(HashTable *hosts, zval *z_fun, zval *z_dist, HashTable *hosts_prev
efree(ra);
return NULL;
}
- ra->prev = hosts_prev ? ra_make_array(hosts_prev, z_fun, z_dist, NULL, b_index, b_pconnect, retry_interval, b_lazy_connect, connect_timeout, read_timeout, consistent, algorithm, auth TSRMLS_CC) : NULL;
+ ra->prev = hosts_prev ? ra_make_array(hosts_prev, z_fun, z_dist, NULL, b_index, b_pconnect, retry_interval, b_lazy_connect, connect_timeout, read_timeout, consistent, algorithm, auth) : NULL;
/* init array data structures */
ra_init_function_table(ra);
@@ -472,21 +472,21 @@ ra_make_array(HashTable *hosts, zval *z_fun, zval *z_dist, HashTable *hosts_prev
/* call userland key extraction function */
zend_string *
-ra_call_extractor(RedisArray *ra, const char *key, int key_len TSRMLS_DC)
+ra_call_extractor(RedisArray *ra, const char *key, int key_len)
{
zend_string *out = NULL;
zval z_ret, z_argv;
/* check that we can call the extractor function */
if (!zend_is_callable_ex(&ra->z_fun, NULL, 0, NULL, NULL, NULL)) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not call extractor function");
+ php_error_docref(NULL, E_ERROR, "Could not call extractor function");
return NULL;
}
ZVAL_NULL(&z_ret);
/* call extraction function */
ZVAL_STRINGL(&z_argv, key, key_len);
- ra_call_user_function(EG(function_table), NULL, &ra->z_fun, &z_ret, 1, &z_argv TSRMLS_CC);
+ ra_call_user_function(EG(function_table), NULL, &ra->z_fun, &z_ret, 1, &z_argv);
if (Z_TYPE(z_ret) == IS_STRING) {
out = zval_get_string(&z_ret);
@@ -498,12 +498,12 @@ ra_call_extractor(RedisArray *ra, const char *key, int key_len TSRMLS_DC)
}
static zend_string *
-ra_extract_key(RedisArray *ra, const char *key, int key_len TSRMLS_DC)
+ra_extract_key(RedisArray *ra, const char *key, int key_len)
{
char *start, *end;
if (Z_TYPE(ra->z_fun) != IS_NULL) {
- return ra_call_extractor(ra, key, key_len TSRMLS_CC);
+ return ra_call_extractor(ra, key, key_len);
} else if ((start = strchr(key, '{')) == NULL || (end = strchr(start + 1, '}')) == NULL) {
return zend_string_init(key, key_len, 0);
}
@@ -513,21 +513,21 @@ ra_extract_key(RedisArray *ra, const char *key, int key_len TSRMLS_DC)
/* call userland key distributor function */
int
-ra_call_distributor(RedisArray *ra, const char *key, int key_len TSRMLS_DC)
+ra_call_distributor(RedisArray *ra, const char *key, int key_len)
{
int ret;
zval z_ret, z_argv;
/* check that we can call the extractor function */
if (!zend_is_callable_ex(&ra->z_dist, NULL, 0, NULL, NULL, NULL)) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not call distributor function");
+ php_error_docref(NULL, E_ERROR, "Could not call distributor function");
return -1;
}
ZVAL_NULL(&z_ret);
/* call extraction function */
ZVAL_STRINGL(&z_argv, key, key_len);
- ra_call_user_function(EG(function_table), NULL, &ra->z_dist, &z_ret, 1, &z_argv TSRMLS_CC);
+ ra_call_user_function(EG(function_table), NULL, &ra->z_dist, &z_ret, 1, &z_argv);
ret = (Z_TYPE(z_ret) == IS_LONG) ? Z_LVAL(z_ret) : -1;
@@ -537,13 +537,13 @@ ra_call_distributor(RedisArray *ra, const char *key, int key_len TSRMLS_DC)
}
zval *
-ra_find_node(RedisArray *ra, const char *key, int key_len, int *out_pos TSRMLS_DC)
+ra_find_node(RedisArray *ra, const char *key, int key_len, int *out_pos)
{
int pos;
zend_string *out;
/* extract relevant part of the key */
- if ((out = ra_extract_key(ra, key, key_len TSRMLS_CC)) == NULL) {
+ if ((out = ra_extract_key(ra, key, key_len)) == NULL) {
return NULL;
}
@@ -591,7 +591,7 @@ ra_find_node(RedisArray *ra, const char *key, int key_len, int *out_pos TSRMLS_D
pos = (int)((ret ^ 0xffffffff) * ra->count / 0xffffffff);
}
} else {
- pos = ra_call_distributor(ra, key, key_len TSRMLS_CC);
+ pos = ra_call_distributor(ra, key, key_len);
if (pos < 0 || pos >= ra->count) {
zend_string_release(out);
return NULL;
@@ -605,7 +605,7 @@ ra_find_node(RedisArray *ra, const char *key, int key_len, int *out_pos TSRMLS_D
}
zval *
-ra_find_node_by_name(RedisArray *ra, const char *host, int host_len TSRMLS_DC) {
+ra_find_node_by_name(RedisArray *ra, const char *host, int host_len) {
int i;
for(i = 0; i < ra->count; ++i) {
@@ -617,7 +617,7 @@ ra_find_node_by_name(RedisArray *ra, const char *host, int host_len TSRMLS_DC) {
}
void
-ra_index_multi(zval *z_redis, long multi_value TSRMLS_DC) {
+ra_index_multi(zval *z_redis, long multi_value) {
zval z_fun_multi, z_ret;
zval z_args[1];
@@ -625,13 +625,13 @@ ra_index_multi(zval *z_redis, long multi_value TSRMLS_DC) {
/* run MULTI */
ZVAL_STRINGL(&z_fun_multi, "MULTI", 5);
ZVAL_LONG(&z_args[0], multi_value);
- ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun_multi, &z_ret, 1, z_args TSRMLS_CC);
+ ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun_multi, &z_ret, 1, z_args);
zval_dtor(&z_fun_multi);
zval_dtor(&z_ret);
}
static void
-ra_index_change_keys(const char *cmd, zval *z_keys, zval *z_redis TSRMLS_DC) {
+ra_index_change_keys(const char *cmd, zval *z_keys, zval *z_redis) {
int i, argc;
zval z_fun, z_ret, *z_args;
@@ -655,7 +655,7 @@ ra_index_change_keys(const char *cmd, zval *z_keys, zval *z_redis TSRMLS_DC) {
}
/* run cmd */
- ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun, &z_ret, argc, z_args TSRMLS_CC);
+ ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun, &z_ret, argc, z_args);
zval_dtor(&z_args[0]);
zval_dtor(&z_fun);
@@ -664,12 +664,12 @@ ra_index_change_keys(const char *cmd, zval *z_keys, zval *z_redis TSRMLS_DC) {
}
void
-ra_index_del(zval *z_keys, zval *z_redis TSRMLS_DC) {
- ra_index_change_keys("SREM", z_keys, z_redis TSRMLS_CC);
+ra_index_del(zval *z_keys, zval *z_redis) {
+ ra_index_change_keys("SREM", z_keys, z_redis);
}
void
-ra_index_keys(zval *z_pairs, zval *z_redis TSRMLS_DC) {
+ra_index_keys(zval *z_pairs, zval *z_redis) {
zval z_keys, *z_val;
zend_string *zkey;
@@ -693,14 +693,14 @@ ra_index_keys(zval *z_pairs, zval *z_redis TSRMLS_DC) {
} ZEND_HASH_FOREACH_END();
/* add keys to index */
- ra_index_change_keys("SADD", &z_keys, z_redis TSRMLS_CC);
+ ra_index_change_keys("SADD", &z_keys, z_redis);
/* cleanup */
zval_dtor(&z_keys);
}
void
-ra_index_key(const char *key, int key_len, zval *z_redis TSRMLS_DC) {
+ra_index_key(const char *key, int key_len, zval *z_redis) {
zval z_fun_sadd, z_ret, z_args[2];
@@ -711,7 +711,7 @@ ra_index_key(const char *key, int key_len, zval *z_redis TSRMLS_DC) {
ZVAL_STRINGL(&z_args[1], key, key_len);
/* run SADD */
- ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun_sadd, &z_ret, 2, z_args TSRMLS_CC);
+ ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun_sadd, &z_ret, 2, z_args);
zval_dtor(&z_fun_sadd);
zval_dtor(&z_args[1]);
zval_dtor(&z_args[0]);
@@ -719,13 +719,13 @@ ra_index_key(const char *key, int key_len, zval *z_redis TSRMLS_DC) {
}
void
-ra_index_exec(zval *z_redis, zval *return_value, int keep_all TSRMLS_DC) {
+ra_index_exec(zval *z_redis, zval *return_value, int keep_all) {
zval z_fun_exec, z_ret, *zp_tmp;
/* run EXEC */
ZVAL_STRINGL(&z_fun_exec, "EXEC", 4);
- ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun_exec, &z_ret, 0, NULL TSRMLS_CC);
+ ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun_exec, &z_ret, 0, NULL);
zval_dtor(&z_fun_exec);
/* extract first element of exec array and put into return_value. */
@@ -742,30 +742,30 @@ ra_index_exec(zval *z_redis, zval *return_value, int keep_all TSRMLS_DC) {
zval_dtor(&z_ret);
/* zval *zptr = &z_ret; */
- /* php_var_dump(&zptr, 0 TSRMLS_CC); */
+ /* php_var_dump(&zptr, 0); */
}
void
-ra_index_discard(zval *z_redis, zval *return_value TSRMLS_DC) {
+ra_index_discard(zval *z_redis, zval *return_value) {
zval z_fun_discard, z_ret;
/* run DISCARD */
ZVAL_STRINGL(&z_fun_discard, "DISCARD", 7);
- ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun_discard, &z_ret, 0, NULL TSRMLS_CC);
+ ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun_discard, &z_ret, 0, NULL);
zval_dtor(&z_fun_discard);
zval_dtor(&z_ret);
}
void
-ra_index_unwatch(zval *z_redis, zval *return_value TSRMLS_DC) {
+ra_index_unwatch(zval *z_redis, zval *return_value) {
zval z_fun_unwatch, z_ret;
/* run UNWATCH */
ZVAL_STRINGL(&z_fun_unwatch, "UNWATCH", 7);
- ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun_unwatch, &z_ret, 0, NULL TSRMLS_CC);
+ ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun_unwatch, &z_ret, 0, NULL);
zval_dtor(&z_fun_unwatch);
zval_dtor(&z_ret);
@@ -790,14 +790,14 @@ ra_is_write_cmd(RedisArray *ra, const char *cmd, int cmd_len) {
/* run TYPE to find the type */
static zend_bool
-ra_get_key_type(zval *z_redis, const char *key, int key_len, zval *z_from, long *res TSRMLS_DC) {
+ra_get_key_type(zval *z_redis, const char *key, int key_len, zval *z_from, long *res) {
int i = 0;
zval z_fun, z_ret, z_arg, *z_data;
long success = 1;
/* Pipelined */
- ra_index_multi(z_from, PIPELINE TSRMLS_CC);
+ ra_index_multi(z_from, PIPELINE);
/* prepare args */
ZVAL_STRINGL(&z_arg, key, key_len);
@@ -805,19 +805,19 @@ ra_get_key_type(zval *z_redis, const char *key, int key_len, zval *z_from, long
/* run TYPE */
ZVAL_NULL(&z_ret);
ZVAL_STRINGL(&z_fun, "TYPE", 4);
- ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun, &z_ret, 1, &z_arg TSRMLS_CC);
+ ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun, &z_ret, 1, &z_arg);
zval_dtor(&z_fun);
zval_dtor(&z_ret);
/* run TYPE */
ZVAL_NULL(&z_ret);
ZVAL_STRINGL(&z_fun, "TTL", 3);
- ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun, &z_ret, 1, &z_arg TSRMLS_CC);
+ ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun, &z_ret, 1, &z_arg);
zval_dtor(&z_fun);
zval_dtor(&z_ret);
/* Get the result from the pipeline. */
- ra_index_exec(z_from, &z_ret, 1 TSRMLS_CC);
+ ra_index_exec(z_from, &z_ret, 1);
if (Z_TYPE(z_ret) == IS_ARRAY) {
ZEND_HASH_FOREACH_VAL(Z_ARRVAL(z_ret), z_data) {
if (z_data == NULL || Z_TYPE_P(z_data) != IS_LONG) {
@@ -835,7 +835,7 @@ ra_get_key_type(zval *z_redis, const char *key, int key_len, zval *z_from, long
/* delete key from source server index during rehashing */
static void
-ra_remove_from_index(zval *z_redis, const char *key, int key_len TSRMLS_DC) {
+ra_remove_from_index(zval *z_redis, const char *key, int key_len) {
zval z_fun_srem, z_ret, z_args[2];
@@ -844,7 +844,7 @@ ra_remove_from_index(zval *z_redis, const char *key, int key_len TSRMLS_DC) {
ZVAL_STRINGL(&z_args[0], PHPREDIS_INDEX_NAME, sizeof(PHPREDIS_INDEX_NAME) - 1);
ZVAL_STRINGL(&z_args[1], key, key_len);
- ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun_srem, &z_ret, 2, z_args TSRMLS_CC);
+ ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun_srem, &z_ret, 2, z_args);
/* cleanup */
zval_dtor(&z_fun_srem);
@@ -856,32 +856,32 @@ ra_remove_from_index(zval *z_redis, const char *key, int key_len TSRMLS_DC) {
/* delete key from source server during rehashing */
static zend_bool
-ra_del_key(const char *key, int key_len, zval *z_from TSRMLS_DC) {
+ra_del_key(const char *key, int key_len, zval *z_from) {
zval z_fun_del, z_ret, z_args[1];
/* in a transaction */
- ra_index_multi(z_from, MULTI TSRMLS_CC);
+ ra_index_multi(z_from, MULTI);
/* run DEL on source */
ZVAL_STRINGL(&z_fun_del, "DEL", 3);
ZVAL_STRINGL(&z_args[0], key, key_len);
- ra_call_user_function(&redis_ce->function_table, z_from, &z_fun_del, &z_ret, 1, z_args TSRMLS_CC);
+ ra_call_user_function(&redis_ce->function_table, z_from, &z_fun_del, &z_ret, 1, z_args);
zval_dtor(&z_fun_del);
zval_dtor(&z_args[0]);
zval_dtor(&z_ret);
/* remove key from index */
- ra_remove_from_index(z_from, key, key_len TSRMLS_CC);
+ ra_remove_from_index(z_from, key, key_len);
/* close transaction */
- ra_index_exec(z_from, NULL, 0 TSRMLS_CC);
+ ra_index_exec(z_from, NULL, 0);
return 1;
}
static zend_bool
-ra_expire_key(const char *key, int key_len, zval *z_to, long ttl TSRMLS_DC) {
+ra_expire_key(const char *key, int key_len, zval *z_to, long ttl) {
zval z_fun_expire, z_ret, z_args[2];
@@ -891,7 +891,7 @@ ra_expire_key(const char *key, int key_len, zval *z_to, long ttl TSRMLS_DC) {
ZVAL_STRINGL(&z_fun_expire, "EXPIRE", 6);
ZVAL_STRINGL(&z_args[0], key, key_len);
ZVAL_LONG(&z_args[1], ttl);
- ra_call_user_function(&redis_ce->function_table, z_to, &z_fun_expire, &z_ret, 2, z_args TSRMLS_CC);
+ ra_call_user_function(&redis_ce->function_table, z_to, &z_fun_expire, &z_ret, 2, z_args);
zval_dtor(&z_fun_expire);
zval_dtor(&z_args[0]);
zval_dtor(&z_ret);
@@ -901,7 +901,7 @@ ra_expire_key(const char *key, int key_len, zval *z_to, long ttl TSRMLS_DC) {
}
static zend_bool
-ra_move_zset(const char *key, int key_len, zval *z_from, zval *z_to, long ttl TSRMLS_DC) {
+ra_move_zset(const char *key, int key_len, zval *z_from, zval *z_to, long ttl) {
zval z_fun_zrange, z_fun_zadd, z_ret, z_ret_dest, z_args[4], *z_zadd_args, *z_score_p;
int i, count;
@@ -915,7 +915,7 @@ ra_move_zset(const char *key, int key_len, zval *z_from, zval *z_to, long ttl TS
ZVAL_STRINGL(&z_args[1], "0", 1);
ZVAL_STRINGL(&z_args[2], "-1", 2);
ZVAL_BOOL(&z_args[3], 1);
- ra_call_user_function(&redis_ce->function_table, z_from, &z_fun_zrange, &z_ret, 4, z_args TSRMLS_CC);
+ ra_call_user_function(&redis_ce->function_table, z_from, &z_fun_zrange, &z_ret, 4, z_args);
zval_dtor(&z_fun_zrange);
zval_dtor(&z_args[2]);
zval_dtor(&z_args[1]);
@@ -953,10 +953,10 @@ ra_move_zset(const char *key, int key_len, zval *z_from, zval *z_to, long ttl TS
/* run ZADD on target */
ZVAL_STRINGL(&z_fun_zadd, "ZADD", 4);
- ra_call_user_function(&redis_ce->function_table, z_to, &z_fun_zadd, &z_ret_dest, 1 + 2 * count, z_zadd_args TSRMLS_CC);
+ ra_call_user_function(&redis_ce->function_table, z_to, &z_fun_zadd, &z_ret_dest, 1 + 2 * count, z_zadd_args);
/* Expire if needed */
- ra_expire_key(key, key_len, z_to, ttl TSRMLS_CC);
+ ra_expire_key(key, key_len, z_to, ttl);
/* cleanup */
zval_dtor(&z_fun_zadd);
@@ -973,14 +973,14 @@ ra_move_zset(const char *key, int key_len, zval *z_from, zval *z_to, long ttl TS
}
static zend_bool
-ra_move_string(const char *key, int key_len, zval *z_from, zval *z_to, long ttl TSRMLS_DC) {
+ra_move_string(const char *key, int key_len, zval *z_from, zval *z_to, long ttl) {
zval z_fun_get, z_fun_set, z_ret, z_args[3];
/* run GET on source */
ZVAL_STRINGL(&z_fun_get, "GET", 3);
ZVAL_STRINGL(&z_args[0], key, key_len);
- ra_call_user_function(&redis_ce->function_table, z_from, &z_fun_get, &z_ret, 1, z_args TSRMLS_CC);
+ ra_call_user_function(&redis_ce->function_table, z_from, &z_fun_get, &z_ret, 1, z_args);
zval_dtor(&z_fun_get);
if(Z_TYPE(z_ret) != IS_STRING) { /* key not found or replaced */
@@ -996,14 +996,14 @@ ra_move_string(const char *key, int key_len, zval *z_from, zval *z_to, long ttl
ZVAL_LONG(&z_args[1], ttl);
ZVAL_STRINGL(&z_args[2], Z_STRVAL(z_ret), Z_STRLEN(z_ret)); /* copy z_ret to arg 1 */
zval_dtor(&z_ret); /* free memory from our previous call */
- ra_call_user_function(&redis_ce->function_table, z_to, &z_fun_set, &z_ret, 3, z_args TSRMLS_CC);
+ ra_call_user_function(&redis_ce->function_table, z_to, &z_fun_set, &z_ret, 3, z_args);
/* cleanup */
zval_dtor(&z_args[2]);
} else {
ZVAL_STRINGL(&z_fun_set, "SET", 3);
ZVAL_STRINGL(&z_args[1], Z_STRVAL(z_ret), Z_STRLEN(z_ret)); /* copy z_ret to arg 1 */
zval_dtor(&z_ret); /* free memory from our previous return value */
- ra_call_user_function(&redis_ce->function_table, z_to, &z_fun_set, &z_ret, 2, z_args TSRMLS_CC);
+ ra_call_user_function(&redis_ce->function_table, z_to, &z_fun_set, &z_ret, 2, z_args);
/* cleanup */
zval_dtor(&z_args[1]);
}
@@ -1015,13 +1015,13 @@ ra_move_string(const char *key, int key_len, zval *z_from, zval *z_to, long ttl
}
static zend_bool
-ra_move_hash(const char *key, int key_len, zval *z_from, zval *z_to, long ttl TSRMLS_DC) {
+ra_move_hash(const char *key, int key_len, zval *z_from, zval *z_to, long ttl) {
zval z_fun_hgetall, z_fun_hmset, z_ret_dest, z_args[2];
/* run HGETALL on source */
ZVAL_STRINGL(&z_args[0], key, key_len);
ZVAL_STRINGL(&z_fun_hgetall, "HGETALL", 7);
- ra_call_user_function(&redis_ce->function_table, z_from, &z_fun_hgetall, &z_args[1], 1, z_args TSRMLS_CC);
+ ra_call_user_function(&redis_ce->function_table, z_from, &z_fun_hgetall, &z_args[1], 1, z_args);
zval_dtor(&z_fun_hgetall);
if (Z_TYPE(z_args[1]) != IS_ARRAY) { /* key not found or replaced */
@@ -1033,12 +1033,12 @@ ra_move_hash(const char *key, int key_len, zval *z_from, zval *z_to, long ttl TS
/* run HMSET on target */
ZVAL_STRINGL(&z_fun_hmset, "HMSET", 5);
- ra_call_user_function(&redis_ce->function_table, z_to, &z_fun_hmset, &z_ret_dest, 2, z_args TSRMLS_CC);
+ ra_call_user_function(&redis_ce->function_table, z_to, &z_fun_hmset, &z_ret_dest, 2, z_args);
zval_dtor(&z_fun_hmset);
zval_dtor(&z_ret_dest);
/* Expire if needed */
- ra_expire_key(key, key_len, z_to, ttl TSRMLS_CC);
+ ra_expire_key(key, key_len, z_to, ttl);
/* cleanup */
zval_dtor(&z_args[1]);
@@ -1050,7 +1050,7 @@ ra_move_hash(const char *key, int key_len, zval *z_from, zval *z_to, long ttl TS
static zend_bool
ra_move_collection(const char *key, int key_len, zval *z_from, zval *z_to,
int list_count, const char **cmd_list,
- int add_count, const char **cmd_add, long ttl TSRMLS_DC) {
+ int add_count, const char **cmd_add, long ttl) {
zval z_fun_retrieve, z_fun_sadd, z_ret, *z_retrieve_args, *z_sadd_args, *z_data_p;
int count, i;
@@ -1068,7 +1068,7 @@ ra_move_collection(const char *key, int key_len, zval *z_from, zval *z_to,
ZVAL_STRING(&z_retrieve_args[i], cmd_list[i]);
}
- ra_call_user_function(&redis_ce->function_table, z_from, &z_fun_retrieve, &z_ret, list_count, z_retrieve_args TSRMLS_CC);
+ ra_call_user_function(&redis_ce->function_table, z_from, &z_fun_retrieve, &z_ret, list_count, z_retrieve_args);
/* cleanup */
zval_dtor(&z_fun_retrieve);
@@ -1100,7 +1100,7 @@ ra_move_collection(const char *key, int key_len, zval *z_from, zval *z_to,
/* Clean up our input return value */
zval_dtor(&z_ret);
- ra_call_user_function(&redis_ce->function_table, z_to, &z_fun_sadd, &z_ret, count, z_sadd_args TSRMLS_CC);
+ ra_call_user_function(&redis_ce->function_table, z_to, &z_fun_sadd, &z_ret, count, z_sadd_args);
/* cleanup */
zval_dtor(&z_fun_sadd);
@@ -1113,56 +1113,56 @@ ra_move_collection(const char *key, int key_len, zval *z_from, zval *z_to,
zval_dtor(&z_ret);
/* Expire if needed */
- ra_expire_key(key, key_len, z_to, ttl TSRMLS_CC);
+ ra_expire_key(key, key_len, z_to, ttl);
return 1;
}
static zend_bool
-ra_move_set(const char *key, int key_len, zval *z_from, zval *z_to, long ttl TSRMLS_DC) {
+ra_move_set(const char *key, int key_len, zval *z_from, zval *z_to, long ttl) {
const char *cmd_list[] = {"SMEMBERS"};
const char *cmd_add[] = {"SADD"};
- return ra_move_collection(key, key_len, z_from, z_to, 1, cmd_list, 1, cmd_add, ttl TSRMLS_CC);
+ return ra_move_collection(key, key_len, z_from, z_to, 1, cmd_list, 1, cmd_add, ttl);
}
static zend_bool
-ra_move_list(const char *key, int key_len, zval *z_from, zval *z_to, long ttl TSRMLS_DC) {
+ra_move_list(const char *key, int key_len, zval *z_from, zval *z_to, long ttl) {
const char *cmd_list[] = {"LRANGE", "0", "-1"};
const char *cmd_add[] = {"RPUSH"};
- return ra_move_collection(key, key_len, z_from, z_to, 3, cmd_list, 1, cmd_add, ttl TSRMLS_CC);
+ return ra_move_collection(key, key_len, z_from, z_to, 3, cmd_list, 1, cmd_add, ttl);
}
void
-ra_move_key(const char *key, int key_len, zval *z_from, zval *z_to TSRMLS_DC) {
+ra_move_key(const char *key, int key_len, zval *z_from, zval *z_to) {
long res[2] = {0}, type, ttl;
zend_bool success = 0;
- if (ra_get_key_type(z_from, key, key_len, z_from, res TSRMLS_CC)) {
+ if (ra_get_key_type(z_from, key, key_len, z_from, res)) {
type = res[0];
ttl = res[1];
/* open transaction on target server */
- ra_index_multi(z_to, MULTI TSRMLS_CC);
+ ra_index_multi(z_to, MULTI);
switch(type) {
case REDIS_STRING:
- success = ra_move_string(key, key_len, z_from, z_to, ttl TSRMLS_CC);
+ success = ra_move_string(key, key_len, z_from, z_to, ttl);
break;
case REDIS_SET:
- success = ra_move_set(key, key_len, z_from, z_to, ttl TSRMLS_CC);
+ success = ra_move_set(key, key_len, z_from, z_to, ttl);
break;
case REDIS_LIST:
- success = ra_move_list(key, key_len, z_from, z_to, ttl TSRMLS_CC);
+ success = ra_move_list(key, key_len, z_from, z_to, ttl);
break;
case REDIS_ZSET:
- success = ra_move_zset(key, key_len, z_from, z_to, ttl TSRMLS_CC);
+ success = ra_move_zset(key, key_len, z_from, z_to, ttl);
break;
case REDIS_HASH:
- success = ra_move_hash(key, key_len, z_from, z_to, ttl TSRMLS_CC);
+ success = ra_move_hash(key, key_len, z_from, z_to, ttl);
break;
default:
@@ -1172,18 +1172,18 @@ ra_move_key(const char *key, int key_len, zval *z_from, zval *z_to TSRMLS_DC) {
}
if(success) {
- ra_del_key(key, key_len, z_from TSRMLS_CC);
- ra_index_key(key, key_len, z_to TSRMLS_CC);
+ ra_del_key(key, key_len, z_from);
+ ra_index_key(key, key_len, z_to);
}
/* close transaction */
- ra_index_exec(z_to, NULL, 0 TSRMLS_CC);
+ ra_index_exec(z_to, NULL, 0);
}
/* callback with the current progress, with hostname and count */
static void
zval_rehash_callback(zend_fcall_info *z_cb, zend_fcall_info_cache *z_cb_cache,
- zend_string *hostname, long count TSRMLS_DC) {
+ zend_string *hostname, long count) {
zval zv, *z_ret = &zv;
@@ -1201,7 +1201,7 @@ zval_rehash_callback(zend_fcall_info *z_cb, zend_fcall_info_cache *z_cb_cache,
z_cb->param_count = 2;
/* run cb(hostname, count) */
- zend_call_function(z_cb, z_cb_cache TSRMLS_CC);
+ zend_call_function(z_cb, z_cb_cache);
/* cleanup */
zval_dtor(&z_args[0]);
@@ -1210,7 +1210,7 @@ zval_rehash_callback(zend_fcall_info *z_cb, zend_fcall_info_cache *z_cb_cache,
static void
ra_rehash_server(RedisArray *ra, zval *z_redis, zend_string *hostname, zend_bool b_index,
- zend_fcall_info *z_cb, zend_fcall_info_cache *z_cb_cache TSRMLS_DC) {
+ zend_fcall_info *z_cb, zend_fcall_info_cache *z_cb_cache) {
HashTable *h_keys;
long count = 0;
@@ -1225,7 +1225,7 @@ ra_rehash_server(RedisArray *ra, zval *z_redis, zend_string *hostname, zend_bool
ZVAL_STRING(&z_argv, "*");
}
ZVAL_NULL(&z_ret);
- ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun, &z_ret, 1, &z_argv TSRMLS_CC);
+ ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun, &z_ret, 1, &z_argv);
zval_dtor(&z_argv);
zval_dtor(&z_fun);
@@ -1241,17 +1241,17 @@ ra_rehash_server(RedisArray *ra, zval *z_redis, zend_string *hostname, zend_bool
/* callback */
if(z_cb && z_cb_cache) {
- zval_rehash_callback(z_cb, z_cb_cache, hostname, count TSRMLS_CC);
+ zval_rehash_callback(z_cb, z_cb_cache, hostname, count);
}
/* for each key, redistribute */
ZEND_HASH_FOREACH_VAL(h_keys, z_ele) {
int pos = 0;
/* check that we're not moving to the same node. */
- zval *z_target = ra_find_node(ra, Z_STRVAL_P(z_ele), Z_STRLEN_P(z_ele), &pos TSRMLS_CC);
+ zval *z_target = ra_find_node(ra, Z_STRVAL_P(z_ele), Z_STRLEN_P(z_ele), &pos);
if (z_target && !zend_string_equals(hostname, ra->hosts[pos])) { /* different host */
- ra_move_key(Z_STRVAL_P(z_ele), Z_STRLEN_P(z_ele), z_redis, z_target TSRMLS_CC);
+ ra_move_key(Z_STRVAL_P(z_ele), Z_STRLEN_P(z_ele), z_redis, z_target);
}
} ZEND_HASH_FOREACH_END();
@@ -1261,7 +1261,7 @@ ra_rehash_server(RedisArray *ra, zval *z_redis, zend_string *hostname, zend_bool
}
void
-ra_rehash(RedisArray *ra, zend_fcall_info *z_cb, zend_fcall_info_cache *z_cb_cache TSRMLS_DC) {
+ra_rehash(RedisArray *ra, zend_fcall_info *z_cb, zend_fcall_info_cache *z_cb_cache) {
int i;
/* redistribute the data, server by server. */
@@ -1269,7 +1269,7 @@ ra_rehash(RedisArray *ra, zend_fcall_info *z_cb, zend_fcall_info_cache *z_cb_cac
return; /* TODO: compare the two rings for equality */
for(i = 0; i < ra->prev->count; ++i) {
- ra_rehash_server(ra, &ra->prev->redis[i], ra->prev->hosts[i], ra->index, z_cb, z_cb_cache TSRMLS_CC);
+ ra_rehash_server(ra, &ra->prev->redis[i], ra->prev->hosts[i], ra->index, z_cb, z_cb_cache);
}
}