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
7ecd4644
Commit
7ecd4644
authored
Dec 14, 2010
by
Pieter Noordhuis
Browse files
Don't decode object on STRLEN when not necessary
parent
cc209063
Changes
1
Show whitespace changes
Inline
Side-by-side
src/t_string.c
View file @
7ecd4644
...
...
@@ -358,7 +358,14 @@ void strlenCommand(redisClient *c) {
if
((
o
=
lookupKeyReadOrReply
(
c
,
c
->
argv
[
1
],
shared
.
czero
))
==
NULL
||
checkType
(
c
,
o
,
REDIS_STRING
))
return
;
o
=
getDecodedObject
(
o
);
if
(
o
->
encoding
==
REDIS_ENCODING_RAW
)
{
addReplyLongLong
(
c
,
sdslen
(
o
->
ptr
));
decrRefCount
(
o
);
}
else
if
(
o
->
encoding
==
REDIS_ENCODING_INT
)
{
char
llbuf
[
32
];
int
len
=
ll2string
(
llbuf
,
sizeof
(
llbuf
),(
long
)
o
->
ptr
);
addReplyLongLong
(
c
,
len
);
}
else
{
redisPanic
(
"Unknown string encoding"
);
}
}
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