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
3a7fd48e
Unverified
Commit
3a7fd48e
authored
Feb 22, 2019
by
Salvatore Sanfilippo
Committed by
GitHub
Feb 22, 2019
Browse files
Merge pull request #5859 from madolson/dev-unstable-networking-cleanup
Refactored manual computation of object length
parents
624568ae
9131fc56
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/networking.c
View file @
3a7fd48e
...
...
@@ -636,23 +636,7 @@ void addReplyNullArray(client *c) {
/* Create the length prefix of a bulk reply, example: $2234 */
void
addReplyBulkLen
(
client
*
c
,
robj
*
obj
)
{
size_t
len
;
if
(
sdsEncodedObject
(
obj
))
{
len
=
sdslen
(
obj
->
ptr
);
}
else
{
long
n
=
(
long
)
obj
->
ptr
;
/* Compute how many bytes will take this integer as a radix 10 string */
len
=
1
;
if
(
n
<
0
)
{
len
++
;
n
=
-
n
;
}
while
((
n
=
n
/
10
)
!=
0
)
{
len
++
;
}
}
size_t
len
=
stringObjectLen
(
obj
);
if
(
len
<
OBJ_SHARED_BULKHDR_LEN
)
addReply
(
c
,
shared
.
bulkhdr
[
len
]);
...
...
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