mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 08:38:27 -05:00
Now all the commands returning a multi bulk reply against non existing keys will return an empty multi bulk, not a nil one
This commit is contained in:
parent
d33278d160
commit
4e27f26863
16
redis.c
16
redis.c
@ -4477,8 +4477,8 @@ static void lrangeCommand(redisClient *c) {
|
|||||||
listNode *ln;
|
listNode *ln;
|
||||||
robj *ele;
|
robj *ele;
|
||||||
|
|
||||||
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.nullmultibulk)) == NULL ||
|
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.emptymultibulk)) == NULL
|
||||||
checkType(c,o,REDIS_LIST)) return;
|
|| checkType(c,o,REDIS_LIST)) return;
|
||||||
list = o->ptr;
|
list = o->ptr;
|
||||||
llen = listLength(list);
|
llen = listLength(list);
|
||||||
|
|
||||||
@ -4811,7 +4811,7 @@ static void sinterGenericCommand(redisClient *c, robj **setskeys, unsigned long
|
|||||||
server.dirty++;
|
server.dirty++;
|
||||||
addReply(c,shared.czero);
|
addReply(c,shared.czero);
|
||||||
} else {
|
} else {
|
||||||
addReply(c,shared.nullmultibulk);
|
addReply(c,shared.emptymultibulk);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5706,8 +5706,8 @@ static void zrangeGenericCommand(redisClient *c, int reverse) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.nullmultibulk)) == NULL ||
|
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.emptymultibulk)) == NULL
|
||||||
checkType(c,o,REDIS_ZSET)) return;
|
|| checkType(c,o,REDIS_ZSET)) return;
|
||||||
zsetobj = o->ptr;
|
zsetobj = o->ptr;
|
||||||
zsl = zsetobj->zsl;
|
zsl = zsetobj->zsl;
|
||||||
llen = zsl->length;
|
llen = zsl->length;
|
||||||
@ -5813,7 +5813,7 @@ static void genericZrangebyscoreCommand(redisClient *c, int justcount) {
|
|||||||
/* Ok, lookup the key and get the range */
|
/* Ok, lookup the key and get the range */
|
||||||
o = lookupKeyRead(c->db,c->argv[1]);
|
o = lookupKeyRead(c->db,c->argv[1]);
|
||||||
if (o == NULL) {
|
if (o == NULL) {
|
||||||
addReply(c,justcount ? shared.czero : shared.nullmultibulk);
|
addReply(c,justcount ? shared.czero : shared.emptymultibulk);
|
||||||
} else {
|
} else {
|
||||||
if (o->type != REDIS_ZSET) {
|
if (o->type != REDIS_ZSET) {
|
||||||
addReply(c,shared.wrongtypeerr);
|
addReply(c,shared.wrongtypeerr);
|
||||||
@ -6220,7 +6220,7 @@ static void genericHgetallCommand(redisClient *c, int flags) {
|
|||||||
robj *o, *lenobj;
|
robj *o, *lenobj;
|
||||||
unsigned long count = 0;
|
unsigned long count = 0;
|
||||||
|
|
||||||
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.nullmultibulk)) == NULL
|
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.emptymultibulk)) == NULL
|
||||||
|| checkType(c,o,REDIS_HASH)) return;
|
|| checkType(c,o,REDIS_HASH)) return;
|
||||||
|
|
||||||
lenobj = createObject(REDIS_STRING,NULL);
|
lenobj = createObject(REDIS_STRING,NULL);
|
||||||
@ -6460,7 +6460,7 @@ static void sortCommand(redisClient *c) {
|
|||||||
/* Lookup the key to sort. It must be of the right types */
|
/* Lookup the key to sort. It must be of the right types */
|
||||||
sortval = lookupKeyRead(c->db,c->argv[1]);
|
sortval = lookupKeyRead(c->db,c->argv[1]);
|
||||||
if (sortval == NULL) {
|
if (sortval == NULL) {
|
||||||
addReply(c,shared.nullmultibulk);
|
addReply(c,shared.emptymultibulk);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (sortval->type != REDIS_SET && sortval->type != REDIS_LIST &&
|
if (sortval->type != REDIS_SET && sortval->type != REDIS_LIST &&
|
||||||
|
Loading…
Reference in New Issue
Block a user