mirror of
https://github.com/fluencelabs/redis
synced 2025-04-01 15:21:03 +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;
|
int i, j;
|
||||||
char buf[REDIS_LONGSTR_SIZE];
|
char buf[REDIS_LONGSTR_SIZE];
|
||||||
list *keys = listCreate();
|
list *keys = listCreate();
|
||||||
listNode *ln, *ln_;
|
listNode *node, *nextnode;
|
||||||
unsigned long cursor = 0;
|
unsigned long cursor = 0;
|
||||||
long count = 1;
|
long count = 1;
|
||||||
sds pat;
|
sds pat;
|
||||||
@ -377,10 +377,10 @@ void scanCommand(redisClient *c) {
|
|||||||
} while (cursor && listLength(keys) < count);
|
} while (cursor && listLength(keys) < count);
|
||||||
|
|
||||||
/* Filter keys */
|
/* Filter keys */
|
||||||
ln = listFirst(keys);
|
node = listFirst(keys);
|
||||||
while (ln) {
|
while (node) {
|
||||||
robj *kobj = listNodeValue(ln);
|
robj *kobj = listNodeValue(node);
|
||||||
ln_ = listNextNode(ln);
|
nextnode = listNextNode(node);
|
||||||
|
|
||||||
/* Keep key iff pattern matches and it hasn't expired */
|
/* Keep key iff pattern matches and it hasn't expired */
|
||||||
if ((patnoop || stringmatchlen(pat, patlen, kobj->ptr, sdslen(kobj->ptr), 0)) &&
|
if ((patnoop || stringmatchlen(pat, patlen, kobj->ptr, sdslen(kobj->ptr), 0)) &&
|
||||||
@ -389,9 +389,9 @@ void scanCommand(redisClient *c) {
|
|||||||
/* Keep */
|
/* Keep */
|
||||||
} else {
|
} else {
|
||||||
decrRefCount(kobj);
|
decrRefCount(kobj);
|
||||||
listDelNode(keys, ln);
|
listDelNode(keys, node);
|
||||||
}
|
}
|
||||||
ln = ln_;
|
node = nextnode;
|
||||||
}
|
}
|
||||||
|
|
||||||
addReplyMultiBulkLen(c, 2);
|
addReplyMultiBulkLen(c, 2);
|
||||||
@ -400,18 +400,18 @@ void scanCommand(redisClient *c) {
|
|||||||
addReplyBulkCBuffer(c, buf, rv);
|
addReplyBulkCBuffer(c, buf, rv);
|
||||||
|
|
||||||
addReplyMultiBulkLen(c, listLength(keys));
|
addReplyMultiBulkLen(c, listLength(keys));
|
||||||
while ((ln = listFirst(keys)) != NULL) {
|
while ((node = listFirst(keys)) != NULL) {
|
||||||
robj *kobj = listNodeValue(ln);
|
robj *kobj = listNodeValue(node);
|
||||||
addReplyBulk(c, kobj);
|
addReplyBulk(c, kobj);
|
||||||
decrRefCount(kobj);
|
decrRefCount(kobj);
|
||||||
listDelNode(keys, ln);
|
listDelNode(keys, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
while ((ln = listFirst(keys)) != NULL) {
|
while ((node = listFirst(keys)) != NULL) {
|
||||||
robj *kobj = listNodeValue(ln);
|
robj *kobj = listNodeValue(node);
|
||||||
decrRefCount(kobj);
|
decrRefCount(kobj);
|
||||||
listDelNode(keys, ln);
|
listDelNode(keys, node);
|
||||||
}
|
}
|
||||||
listRelease(keys);
|
listRelease(keys);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user