mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
RESP3: Use new deferred len API in dict.c.
This commit is contained in:
parent
cdd10193c5
commit
b507654716
8
src/db.c
8
src/db.c
@ -539,7 +539,7 @@ void keysCommand(client *c) {
|
|||||||
sds pattern = c->argv[1]->ptr;
|
sds pattern = c->argv[1]->ptr;
|
||||||
int plen = sdslen(pattern), allkeys;
|
int plen = sdslen(pattern), allkeys;
|
||||||
unsigned long numkeys = 0;
|
unsigned long numkeys = 0;
|
||||||
void *replylen = addDeferredMultiBulkLength(c);
|
void *replylen = addReplyDeferredLen(c);
|
||||||
|
|
||||||
di = dictGetSafeIterator(c->db->dict);
|
di = dictGetSafeIterator(c->db->dict);
|
||||||
allkeys = (pattern[0] == '*' && pattern[1] == '\0');
|
allkeys = (pattern[0] == '*' && pattern[1] == '\0');
|
||||||
@ -557,7 +557,7 @@ void keysCommand(client *c) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dictReleaseIterator(di);
|
dictReleaseIterator(di);
|
||||||
setDeferredMultiBulkLength(c,replylen,numkeys);
|
setDeferredArrayLen(c,replylen,numkeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This callback is used by scanGenericCommand in order to collect elements
|
/* 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. */
|
/* Step 4: Reply to the client. */
|
||||||
addReplyMultiBulkLen(c, 2);
|
addReplyArrayLen(c, 2);
|
||||||
addReplyBulkLongLong(c,cursor);
|
addReplyBulkLongLong(c,cursor);
|
||||||
|
|
||||||
addReplyMultiBulkLen(c, listLength(keys));
|
addReplyArrayLen(c, listLength(keys));
|
||||||
while ((node = listFirst(keys)) != NULL) {
|
while ((node = listFirst(keys)) != NULL) {
|
||||||
robj *kobj = listNodeValue(node);
|
robj *kobj = listNodeValue(node);
|
||||||
addReplyBulk(c, kobj);
|
addReplyBulk(c, kobj);
|
||||||
|
Loading…
Reference in New Issue
Block a user