Merge pull request #4935 from soloestoy/bugfix-zpop

bugfix for ZPOP: fix the wrong keyc, should be 1
This commit is contained in:
Salvatore Sanfilippo 2018-05-22 15:52:21 +02:00 committed by GitHub
commit f1321349d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) {
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) {
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);
} }