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
c4aace90
Commit
c4aace90
authored
May 22, 2010
by
Pieter Noordhuis
Browse files
fix compare function of ziplist to only load integer from ziplist when it is encoded as integer
parent
6205b463
Changes
1
Show whitespace changes
Inline
Side-by-side
ziplist.c
View file @
c4aace90
...
...
@@ -374,18 +374,23 @@ unsigned int ziplistCompare(unsigned char *p, unsigned char *entry, unsigned int
if
(
*
p
==
ZIP_END
)
return
0
;
zlen
=
zipDecodeLength
(
p
,
&
lensize
);
if
(
zipTryEncoding
(
entry
,
&
eval
,
&
encoding
))
{
/* Do integer compare */
zval
=
zipLoadInteger
(
p
+
lensize
,
ZIP_ENCODING
(
p
));
return
zval
==
eval
;
}
else
{
if
(
ZIP_ENCODING
(
p
)
==
ZIP_ENC_RAW
)
{
/* Raw compare */
if
(
zlen
==
elen
)
{
return
memcmp
(
p
+
lensize
,
entry
,
elen
)
==
0
;
}
else
{
return
0
;
}
}
else
{
if
(
zipTryEncoding
(
entry
,
&
eval
,
&
encoding
))
{
/* Do integer compare */
zval
=
zipLoadInteger
(
p
+
lensize
,
ZIP_ENCODING
(
p
));
return
zval
==
eval
;
}
else
{
/* Ziplist entry is integer encoded, but given entry is not. */
}
}
return
0
;
}
/* Return length of ziplist. */
...
...
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