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
b5076547
Commit
b5076547
authored
Nov 09, 2018
by
antirez
Browse files
RESP3: Use new deferred len API in dict.c.
parent
cdd10193
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/db.c
View file @
b5076547
...
@@ -539,7 +539,7 @@ void keysCommand(client *c) {
...
@@ -539,7 +539,7 @@ void keysCommand(client *c) {
sds
pattern
=
c
->
argv
[
1
]
->
ptr
;
sds
pattern
=
c
->
argv
[
1
]
->
ptr
;
int
plen
=
sdslen
(
pattern
),
allkeys
;
int
plen
=
sdslen
(
pattern
),
allkeys
;
unsigned
long
numkeys
=
0
;
unsigned
long
numkeys
=
0
;
void
*
replylen
=
addDeferred
MultiBulkLength
(
c
);
void
*
replylen
=
add
Reply
Deferred
Len
(
c
);
di
=
dictGetSafeIterator
(
c
->
db
->
dict
);
di
=
dictGetSafeIterator
(
c
->
db
->
dict
);
allkeys
=
(
pattern
[
0
]
==
'*'
&&
pattern
[
1
]
==
'\0'
);
allkeys
=
(
pattern
[
0
]
==
'*'
&&
pattern
[
1
]
==
'\0'
);
...
@@ -557,7 +557,7 @@ void keysCommand(client *c) {
...
@@ -557,7 +557,7 @@ void keysCommand(client *c) {
}
}
}
}
dictReleaseIterator
(
di
);
dictReleaseIterator
(
di
);
setDeferred
MultiBulkLength
(
c
,
replylen
,
numkeys
);
setDeferred
ArrayLen
(
c
,
replylen
,
numkeys
);
}
}
/* This callback is used by scanGenericCommand in order to collect elements
/* This callback is used by scanGenericCommand in order to collect elements
...
@@ -782,10 +782,10 @@ void scanGenericCommand(client *c, robj *o, unsigned long cursor) {
...
@@ -782,10 +782,10 @@ void scanGenericCommand(client *c, robj *o, unsigned long cursor) {
}
}
/* Step 4: Reply to the client. */
/* Step 4: Reply to the client. */
addReply
MultiBulk
Len
(
c
,
2
);
addReply
Array
Len
(
c
,
2
);
addReplyBulkLongLong
(
c
,
cursor
);
addReplyBulkLongLong
(
c
,
cursor
);
addReply
MultiBulk
Len
(
c
,
listLength
(
keys
));
addReply
Array
Len
(
c
,
listLength
(
keys
));
while
((
node
=
listFirst
(
keys
))
!=
NULL
)
{
while
((
node
=
listFirst
(
keys
))
!=
NULL
)
{
robj
*
kobj
=
listNodeValue
(
node
);
robj
*
kobj
=
listNodeValue
(
node
);
addReplyBulk
(
c
,
kobj
);
addReplyBulk
(
c
,
kobj
);
...
...
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