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
21da9b06
Commit
21da9b06
authored
Oct 25, 2013
by
antirez
Browse files
SCAN: improve variable names for readability.
parent
907e06cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/db.c
View file @
21da9b06
...
@@ -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 */
l
n
=
listFirst
(
keys
);
n
ode
=
listFirst
(
keys
);
while
(
l
n
)
{
while
(
n
ode
)
{
robj
*
kobj
=
listNodeValue
(
l
n
);
robj
*
kobj
=
listNodeValue
(
n
ode
);
ln_
=
listNextNode
(
l
n
);
nextnode
=
listNextNode
(
n
ode
);
/* 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
,
l
n
);
listDelNode
(
keys
,
n
ode
);
}
}
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
((
l
n
=
listFirst
(
keys
))
!=
NULL
)
{
while
((
n
ode
=
listFirst
(
keys
))
!=
NULL
)
{
robj
*
kobj
=
listNodeValue
(
l
n
);
robj
*
kobj
=
listNodeValue
(
n
ode
);
addReplyBulk
(
c
,
kobj
);
addReplyBulk
(
c
,
kobj
);
decrRefCount
(
kobj
);
decrRefCount
(
kobj
);
listDelNode
(
keys
,
l
n
);
listDelNode
(
keys
,
n
ode
);
}
}
cleanup:
cleanup:
while
((
l
n
=
listFirst
(
keys
))
!=
NULL
)
{
while
((
n
ode
=
listFirst
(
keys
))
!=
NULL
)
{
robj
*
kobj
=
listNodeValue
(
l
n
);
robj
*
kobj
=
listNodeValue
(
n
ode
);
decrRefCount
(
kobj
);
decrRefCount
(
kobj
);
listDelNode
(
keys
,
l
n
);
listDelNode
(
keys
,
n
ode
);
}
}
listRelease
(
keys
);
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