Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
fd1b0ad0
Commit
fd1b0ad0
authored
Oct 25, 2013
by
antirez
Browse files
SCAN: improve variable names for readability.
parent
908eba5a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/db.c
View file @
fd1b0ad0
...
...
@@ -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 */
l
n
=
listFirst
(
keys
);
while
(
l
n
)
{
robj
*
kobj
=
listNodeValue
(
l
n
);
ln_
=
listNextNode
(
l
n
);
n
ode
= listFirst(keys);
while (n
ode
) {
robj *kobj = listNodeValue(n
ode
);
nextnode
= listNextNode(n
ode
);
/* 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
,
l
n
);
listDelNode(keys, n
ode
);
}
ln
=
ln_
;
node = nextnode
;
}
addReplyMultiBulkLen(c, 2);
...
...
@@ -400,18 +400,18 @@ void scanCommand(redisClient *c) {
addReplyBulkCBuffer(c, buf, rv);
addReplyMultiBulkLen(c, listLength(keys));
while
((
l
n
=
listFirst
(
keys
))
!=
NULL
)
{
robj
*
kobj
=
listNodeValue
(
l
n
);
while ((n
ode
= listFirst(keys)) != NULL) {
robj *kobj = listNodeValue(n
ode
);
addReplyBulk(c, kobj);
decrRefCount(kobj);
listDelNode
(
keys
,
l
n
);
listDelNode(keys, n
ode
);
}
cleanup:
while
((
l
n
=
listFirst
(
keys
))
!=
NULL
)
{
robj
*
kobj
=
listNodeValue
(
l
n
);
while ((n
ode
= listFirst(keys)) != NULL) {
robj *kobj = listNodeValue(n
ode
);
decrRefCount(kobj);
listDelNode
(
keys
,
l
n
);
listDelNode(keys, n
ode
);
}
listRelease(keys);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment