mirror of
https://github.com/fluencelabs/redis
synced 2025-03-17 16:10:50 +00:00
SCAN: improve variable names for readability.
This commit is contained in:
parent
908eba5a8f
commit
fd1b0ad07c
26
src/db.c
26
src/db.c
@ -331,7 +331,7 @@ void scanCommand(redisClient *c) {
|
||||
int i, j;
|
||||
char buf[REDIS_LONGSTR_SIZE];
|
||||
list *keys = listCreate();
|
||||
listNode *ln, *ln_;
|
||||
listNode *node, *nextnode;
|
||||
unsigned long cursor = 0;
|
||||
long count = 1;
|
||||
sds pat;
|
||||
@ -377,10 +377,10 @@ void scanCommand(redisClient *c) {
|
||||
} while (cursor && listLength(keys) < count);
|
||||
|
||||
/* Filter keys */
|
||||
ln = listFirst(keys);
|
||||
while (ln) {
|
||||
robj *kobj = listNodeValue(ln);
|
||||
ln_ = listNextNode(ln);
|
||||
node = listFirst(keys);
|
||||
while (node) {
|
||||
robj *kobj = listNodeValue(node);
|
||||
nextnode = listNextNode(node);
|
||||
|
||||
/* Keep key iff pattern matches and it hasn't expired */
|
||||
if ((patnoop || stringmatchlen(pat, patlen, kobj->ptr, sdslen(kobj->ptr), 0)) &&
|
||||
@ -389,9 +389,9 @@ void scanCommand(redisClient *c) {
|
||||
/* Keep */
|
||||
} else {
|
||||
decrRefCount(kobj);
|
||||
listDelNode(keys, ln);
|
||||
listDelNode(keys, node);
|
||||
}
|
||||
ln = ln_;
|
||||
node = nextnode;
|
||||
}
|
||||
|
||||
addReplyMultiBulkLen(c, 2);
|
||||
@ -400,18 +400,18 @@ void scanCommand(redisClient *c) {
|
||||
addReplyBulkCBuffer(c, buf, rv);
|
||||
|
||||
addReplyMultiBulkLen(c, listLength(keys));
|
||||
while ((ln = listFirst(keys)) != NULL) {
|
||||
robj *kobj = listNodeValue(ln);
|
||||
while ((node = listFirst(keys)) != NULL) {
|
||||
robj *kobj = listNodeValue(node);
|
||||
addReplyBulk(c, kobj);
|
||||
decrRefCount(kobj);
|
||||
listDelNode(keys, ln);
|
||||
listDelNode(keys, node);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
while ((ln = listFirst(keys)) != NULL) {
|
||||
robj *kobj = listNodeValue(ln);
|
||||
while ((node = listFirst(keys)) != NULL) {
|
||||
robj *kobj = listNodeValue(node);
|
||||
decrRefCount(kobj);
|
||||
listDelNode(keys, ln);
|
||||
listDelNode(keys, node);
|
||||
}
|
||||
listRelease(keys);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user