RESP3: Use new deferred len API in dict.c.

This commit is contained in:
antirez 2018-11-09 12:59:00 +01:00
parent cdd10193c5
commit b507654716

View File

@ -539,7 +539,7 @@ void keysCommand(client *c) {
sds pattern = c->argv[1]->ptr;
int plen = sdslen(pattern), allkeys;
unsigned long numkeys = 0;
void *replylen = addDeferredMultiBulkLength(c);
void *replylen = addReplyDeferredLen(c);
di = dictGetSafeIterator(c->db->dict);
allkeys = (pattern[0] == '*' && pattern[1] == '\0');
@ -557,7 +557,7 @@ void keysCommand(client *c) {
}
}
dictReleaseIterator(di);
setDeferredMultiBulkLength(c,replylen,numkeys);
setDeferredArrayLen(c,replylen,numkeys);
}
/* This callback is used by scanGenericCommand in order to collect elements
@ -782,10 +782,10 @@ void scanGenericCommand(client *c, robj *o, unsigned long cursor) {
}
/* Step 4: Reply to the client. */
addReplyMultiBulkLen(c, 2);
addReplyArrayLen(c, 2);
addReplyBulkLongLong(c,cursor);
addReplyMultiBulkLen(c, listLength(keys));
addReplyArrayLen(c, listLength(keys));
while ((node = listFirst(keys)) != NULL) {
robj *kobj = listNodeValue(node);
addReplyBulk(c, kobj);