Commit 21da9b06 authored by antirez's avatar antirez
Browse files

SCAN: improve variable names for readability.

parent 907e06cd
...@@ -321,7 +321,7 @@ void scanCommand(redisClient *c) { ...@@ -321,7 +321,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;
...@@ -367,10 +367,10 @@ void scanCommand(redisClient *c) { ...@@ -367,10 +367,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)) &&
...@@ -379,9 +379,9 @@ void scanCommand(redisClient *c) { ...@@ -379,9 +379,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);
...@@ -390,18 +390,18 @@ void scanCommand(redisClient *c) { ...@@ -390,18 +390,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);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment