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
f521498b
Commit
f521498b
authored
Feb 12, 2021
by
Viktor Söderqvist
Committed by
Oran Agra
Feb 16, 2021
Browse files
Avoid useless copying in LINDEX command for reply
parent
fb3457d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/t_list.c
View file @
f521498b
...
...
@@ -324,7 +324,6 @@ void lindexCommand(client *c) {
robj
*
o
=
lookupKeyReadOrReply
(
c
,
c
->
argv
[
1
],
shared
.
null
[
c
->
resp
]);
if
(
o
==
NULL
||
checkType
(
c
,
o
,
OBJ_LIST
))
return
;
long
index
;
robj
*
value
=
NULL
;
if
((
getLongFromObjectOrReply
(
c
,
c
->
argv
[
2
],
&
index
,
NULL
)
!=
C_OK
))
return
;
...
...
@@ -333,12 +332,10 @@ void lindexCommand(client *c) {
quicklistEntry
entry
;
if
(
quicklistIndex
(
o
->
ptr
,
index
,
&
entry
))
{
if
(
entry
.
value
)
{
value
=
createStringObject
((
char
*
)
entry
.
value
,
entry
.
sz
);
addReplyBulkCBuffer
(
c
,
entry
.
value
,
entry
.
sz
);
}
else
{
value
=
createStringObjectFrom
LongLong
(
entry
.
longval
);
addReplyBulk
LongLong
(
c
,
entry
.
longval
);
}
addReplyBulk
(
c
,
value
);
decrRefCount
(
value
);
}
else
{
addReplyNull
(
c
);
}
...
...
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