RESP3: most null replies converted.

This commit is contained in:
antirez
2018-11-30 09:41:54 +01:00
parent 1b7298e66a
commit 317f8b9d38
15 changed files with 66 additions and 60 deletions

View File

@ -1638,7 +1638,7 @@ reply_to_client:
if (processed)
addReplyDouble(c,score);
else
addReply(c,shared.nullbulk);
addReplyNull(c);
} else { /* ZADD. */
addReplyLongLong(c,ch ? added+updated : added);
}
@ -2427,7 +2427,7 @@ void zrangeGenericCommand(client *c, int reverse) {
return;
}
if ((zobj = lookupKeyReadOrReply(c,key,shared.emptymultibulk)) == NULL
if ((zobj = lookupKeyReadOrReply(c,key,shared.null[c->resp])) == NULL
|| checkType(c,zobj,OBJ_ZSET)) return;
/* Sanitize indexes. */
@ -2439,7 +2439,7 @@ void zrangeGenericCommand(client *c, int reverse) {
/* Invariant: start >= 0, so this test will be true when end < 0.
* The range is empty when start > end or start >= length. */
if (start > end || start >= llen) {
addReply(c,shared.emptymultibulk);
addReplyNull(c);
return;
}
if (end >= llen) end = llen-1;
@ -2571,7 +2571,7 @@ void genericZrangebyscoreCommand(client *c, int reverse) {
}
/* Ok, lookup the key and get the range */
if ((zobj = lookupKeyReadOrReply(c,key,shared.emptymultibulk)) == NULL ||
if ((zobj = lookupKeyReadOrReply(c,key,shared.null[c->resp])) == NULL ||
checkType(c,zobj,OBJ_ZSET)) return;
if (zobj->encoding == OBJ_ENCODING_ZIPLIST) {
@ -2591,7 +2591,7 @@ void genericZrangebyscoreCommand(client *c, int reverse) {
/* No "first" element in the specified interval. */
if (eptr == NULL) {
addReply(c, shared.emptymultibulk);
addReplyNull(c);
return;
}
@ -2658,7 +2658,7 @@ void genericZrangebyscoreCommand(client *c, int reverse) {
/* No "first" element in the specified interval. */
if (ln == NULL) {
addReply(c, shared.emptymultibulk);
addReplyNull(c);
return;
}
@ -2913,7 +2913,7 @@ void genericZrangebylexCommand(client *c, int reverse) {
}
/* Ok, lookup the key and get the range */
if ((zobj = lookupKeyReadOrReply(c,key,shared.emptymultibulk)) == NULL ||
if ((zobj = lookupKeyReadOrReply(c,key,shared.null[c->resp])) == NULL ||
checkType(c,zobj,OBJ_ZSET))
{
zslFreeLexRange(&range);
@ -2936,7 +2936,7 @@ void genericZrangebylexCommand(client *c, int reverse) {
/* No "first" element in the specified interval. */
if (eptr == NULL) {
addReply(c, shared.emptymultibulk);
addReplyNull(c);
zslFreeLexRange(&range);
return;
}
@ -3000,7 +3000,7 @@ void genericZrangebylexCommand(client *c, int reverse) {
/* No "first" element in the specified interval. */
if (ln == NULL) {
addReply(c, shared.emptymultibulk);
addReplyNull(c);
zslFreeLexRange(&range);
return;
}
@ -3069,11 +3069,11 @@ void zscoreCommand(client *c) {
robj *zobj;
double score;
if ((zobj = lookupKeyReadOrReply(c,key,shared.nullbulk)) == NULL ||
if ((zobj = lookupKeyReadOrReply(c,key,shared.null[c->resp])) == NULL ||
checkType(c,zobj,OBJ_ZSET)) return;
if (zsetScore(zobj,c->argv[2]->ptr,&score) == C_ERR) {
addReply(c,shared.nullbulk);
addReplyNull(c);
} else {
addReplyDouble(c,score);
}
@ -3085,7 +3085,7 @@ void zrankGenericCommand(client *c, int reverse) {
robj *zobj;
long rank;
if ((zobj = lookupKeyReadOrReply(c,key,shared.nullbulk)) == NULL ||
if ((zobj = lookupKeyReadOrReply(c,key,shared.null[c->resp])) == NULL ||
checkType(c,zobj,OBJ_ZSET)) return;
serverAssertWithInfo(c,ele,sdsEncodedObject(ele));
@ -3093,7 +3093,7 @@ void zrankGenericCommand(client *c, int reverse) {
if (rank >= 0) {
addReplyLongLong(c,rank);
} else {
addReply(c,shared.nullbulk);
addReplyNull(c);
}
}
@ -3151,7 +3151,7 @@ void genericZpopCommand(client *c, robj **keyv, int keyc, int where, int emitkey
/* No candidate for zpopping, return empty. */
if (!zobj) {
addReply(c,shared.emptymultibulk);
addReplyNull(c);
return;
}
@ -3277,7 +3277,7 @@ void blockingGenericZpopCommand(client *c, int where) {
/* If we are inside a MULTI/EXEC and the zset is empty the only thing
* we can do is treating it as a timeout (even with timeout 0). */
if (c->flags & CLIENT_MULTI) {
addReply(c,shared.nullmultibulk);
addReplyNull(c);
return;
}