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
d71b9865
Commit
d71b9865
authored
May 31, 2010
by
Pieter Noordhuis
Browse files
ziplistNext should work as expected when called with a pointer to ZIP_END
parent
a03611e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
ziplist.c
View file @
d71b9865
...
...
@@ -430,7 +430,16 @@ unsigned char *ziplistIndex(unsigned char *zl, int index) {
/* Return pointer to next entry in ziplist. */
unsigned
char
*
ziplistNext
(
unsigned
char
*
zl
,
unsigned
char
*
p
)
{
((
void
)
zl
);
return
(
p
[
0
]
==
ZIP_END
)
?
NULL
:
p
+
zipRawEntryLength
(
p
);
/* "p" could be equal to ZIP_END, caused by ziplistDelete,
* and we should return NULL. Otherwise, we should return NULL
* when the *next* element is ZIP_END (there is no next entry). */
if
(
p
[
0
]
==
ZIP_END
)
{
return
NULL
;
}
else
{
p
=
p
+
zipRawEntryLength
(
p
);
return
(
p
[
0
]
==
ZIP_END
)
?
NULL
:
p
;
}
}
/* Return pointer to previous entry in 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