Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2ec7d91

Browse files
Remove dead code, fix min_argc for blocking commands
1 parent f89e941 commit 2ec7d91

4 files changed

Lines changed: 13 additions & 21 deletions

File tree

redis.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,14 +1378,14 @@ PHP_METHOD(Redis, rPop)
13781378
/* {{{ proto string Redis::blPop(string key1, string key2, ..., int timeout) */
13791379
PHP_METHOD(Redis, blPop)
13801380
{
1381-
REDIS_PROCESS_KW_CMD("BLPOP", redis_varkey_timeout_cmd, redis_sock_read_multibulk_reply);
1381+
REDIS_PROCESS_KW_CMD("BLPOP", redis_blocking_pop_cmd, redis_sock_read_multibulk_reply);
13821382
}
13831383
/* }}} */
13841384

13851385
/* {{{ proto string Redis::brPop(string key1, string key2, ..., int timeout) */
13861386
PHP_METHOD(Redis, brPop)
13871387
{
1388-
REDIS_PROCESS_KW_CMD("BRPOP", redis_varkey_timeout_cmd, redis_sock_read_multibulk_reply);
1388+
REDIS_PROCESS_KW_CMD("BRPOP", redis_blocking_pop_cmd, redis_sock_read_multibulk_reply);
13891389
}
13901390
/* }}} */
13911391

@@ -2170,13 +2170,13 @@ PHP_METHOD(Redis, zPopMin)
21702170

21712171
/* {{{ proto Redis::bzPopMax(Array(keys) [, timeout]): Array */
21722172
PHP_METHOD(Redis, bzPopMax) {
2173-
REDIS_PROCESS_KW_CMD("BZPOPMAX", redis_varkey_timeout_cmd, redis_sock_read_multibulk_reply);
2173+
REDIS_PROCESS_KW_CMD("BZPOPMAX", redis_blocking_pop_cmd, redis_sock_read_multibulk_reply);
21742174
}
21752175
/* }}} */
21762176

21772177
/* {{{ proto Redis::bzPopMin(Array(keys) [, timeout]): Array */
21782178
PHP_METHOD(Redis, bzPopMin) {
2179-
REDIS_PROCESS_KW_CMD("BZPOPMIN", redis_varkey_timeout_cmd, redis_sock_read_multibulk_reply);
2179+
REDIS_PROCESS_KW_CMD("BZPOPMIN", redis_blocking_pop_cmd, redis_sock_read_multibulk_reply);
21802180
}
21812181
/* }}} */
21822182

redis_cluster.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,13 +1259,13 @@ PHP_METHOD(RedisCluster, rpush) {
12591259

12601260
/* {{{ proto array RedisCluster::blpop(string key1, ... keyN, long timeout) */
12611261
PHP_METHOD(RedisCluster, blpop) {
1262-
CLUSTER_PROCESS_KW_CMD("BLPOP", redis_varkey_timeout_cmd, cluster_mbulk_resp, 0);
1262+
CLUSTER_PROCESS_KW_CMD("BLPOP", redis_blocking_pop_cmd, cluster_mbulk_resp, 0);
12631263
}
12641264
/* }}} */
12651265

12661266
/* {{{ proto array RedisCluster::brpop(string key1, ... keyN, long timeout */
12671267
PHP_METHOD(RedisCluster, brpop) {
1268-
CLUSTER_PROCESS_KW_CMD("BRPOP", redis_varkey_timeout_cmd, cluster_mbulk_resp, 0);
1268+
CLUSTER_PROCESS_KW_CMD("BRPOP", redis_blocking_pop_cmd, cluster_mbulk_resp, 0);
12691269
}
12701270
/* }}} */
12711271

@@ -1874,12 +1874,12 @@ PHP_METHOD(RedisCluster, zpopmin) {
18741874

18751875
/* {{{ proto array RedisCluster::bzPopMin(Array keys [, timeout]) }}} */
18761876
PHP_METHOD(RedisCluster, bzpopmax) {
1877-
CLUSTER_PROCESS_KW_CMD("BZPOPMAX", redis_varkey_timeout_cmd, cluster_mbulk_resp, 0);
1877+
CLUSTER_PROCESS_KW_CMD("BZPOPMAX", redis_blocking_pop_cmd, cluster_mbulk_resp, 0);
18781878
}
18791879

18801880
/* {{{ proto array RedisCluster::bzPopMax(Array keys [, timeout]) }}} */
18811881
PHP_METHOD(RedisCluster, bzpopmin) {
1882-
CLUSTER_PROCESS_KW_CMD("BZPOPMIN", redis_varkey_timeout_cmd, cluster_mbulk_resp, 0);
1882+
CLUSTER_PROCESS_KW_CMD("BZPOPMIN", redis_blocking_pop_cmd, cluster_mbulk_resp, 0);
18831883
}
18841884

18851885
/* {{{ proto RedisCluster::sort(string key, array options) */

redis_commands.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,12 +1252,12 @@ static int gen_varkey_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
12521252
}
12531253

12541254
/* Generic handling of every blocking pop command (BLPOP, BZPOP[MIN/MAX], etc */
1255-
int redis_varkey_timeout_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
1256-
char *kw, char **cmd, int *cmd_len, short *slot,
1257-
void **ctx)
1255+
int redis_blocking_pop_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
1256+
char *kw, char **cmd, int *cmd_len, short *slot,
1257+
void **ctx)
12581258
{
12591259
return gen_varkey_cmd(INTERNAL_FUNCTION_PARAM_PASSTHRU, redis_sock, kw,
1260-
strlen(kw), 2, 1, cmd, cmd_len, slot);
1260+
strlen(kw), 2, 2, cmd, cmd_len, slot);
12611261
}
12621262

12631263
/*
@@ -3053,14 +3053,6 @@ int redis_watch_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
30533053
"WATCH", sizeof("WATCH")-1, 1, 0, cmd, cmd_len, slot);
30543054
}
30553055

3056-
/* BLPOP */
3057-
int redis_blpop_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
3058-
char **cmd, int *cmd_len, short *slot, void **ctx)
3059-
{
3060-
return gen_varkey_cmd(INTERNAL_FUNCTION_PARAM_PASSTHRU, redis_sock,
3061-
"BLPOP", sizeof("BLPOP")-1, 2, 1, cmd, cmd_len, slot);
3062-
}
3063-
30643056
/* SINTER */
30653057
int redis_sinter_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
30663058
char **cmd, int *cmd_len, short *slot, void **ctx)

redis_commands.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ int redis_key_val_arr_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
7878
int redis_key_str_arr_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
7979
char *kw, char **cmd, int *cmd_len, short *slot, void **ctx);
8080

81-
int redis_varkey_timeout_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
81+
int redis_blocking_pop_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
8282
char *kw, char **cmd, int *cmd_len, short *slot, void **ctx);
8383

8484
/* Construct SCAN and similar commands, as well as check iterator */

0 commit comments

Comments
 (0)