Unverified Commit f1321349 authored by Salvatore Sanfilippo's avatar Salvatore Sanfilippo Committed by GitHub
Browse files

Merge pull request #4935 from soloestoy/bugfix-zpop

bugfix for ZPOP: fix the wrong keyc, should be 1
parents 3c968ff0 4e7a160b
...@@ -3080,8 +3080,8 @@ void zscanCommand(client *c) { ...@@ -3080,8 +3080,8 @@ void zscanCommand(client *c) {
* use the 'count' argument to return multiple items if available. */ * use the 'count' argument to return multiple items if available. */
void genericZpopCommand(client *c, robj **keyv, int keyc, int where, int emitkey, robj *countarg) { void genericZpopCommand(client *c, robj **keyv, int keyc, int where, int emitkey, robj *countarg) {
int idx; int idx;
robj *key; robj *key = NULL;
robj *zobj; robj *zobj = NULL;
sds ele; sds ele;
double score; double score;
long count = 1; long count = 1;
...@@ -3185,7 +3185,7 @@ void zpopminCommand(client *c) { ...@@ -3185,7 +3185,7 @@ void zpopminCommand(client *c) {
addReply(c,shared.syntaxerr); addReply(c,shared.syntaxerr);
return; return;
} }
genericZpopCommand(c,&c->argv[1],c->argc-1,ZSET_MIN,0, genericZpopCommand(c,&c->argv[1],1,ZSET_MIN,0,
c->argc == 3 ? c->argv[2] : NULL); c->argc == 3 ? c->argv[2] : NULL);
} }
...@@ -3195,7 +3195,7 @@ void zpopmaxCommand(client *c) { ...@@ -3195,7 +3195,7 @@ void zpopmaxCommand(client *c) {
addReply(c,shared.syntaxerr); addReply(c,shared.syntaxerr);
return; return;
} }
genericZpopCommand(c,&c->argv[1],c->argc-1,ZSET_MAX,0, genericZpopCommand(c,&c->argv[1],1,ZSET_MAX,0,
c->argc == 3 ? c->argv[2] : NULL); c->argc == 3 ? c->argv[2] : NULL);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment