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
33c1269e
Commit
33c1269e
authored
May 21, 2010
by
Pieter Noordhuis
Browse files
check if *value is non-NULL before setting it
parent
335d16bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
ziplist.c
View file @
33c1269e
...
...
@@ -87,13 +87,13 @@ unsigned char *ziplistPush(unsigned char *zl, unsigned char *entry, unsigned int
unsigned
char
*
ziplistPop
(
unsigned
char
*
zl
,
sds
*
value
,
int
where
)
{
unsigned
int
curlen
=
ZIPLIST_BYTES
(
zl
),
len
,
rlen
;
unsigned
char
*
p
;
*
value
=
NULL
;
if
(
value
)
*
value
=
NULL
;
/* Get pointer to element to remove */
p
=
(
where
==
ZIPLIST_HEAD
)
?
ziplistHead
(
zl
)
:
ziplistTail
(
zl
);
if
(
*
p
==
ZIP_END
)
return
zl
;
len
=
zipDecodeLength
(
p
);
*
value
=
sdsnewlen
(
p
+
zipEncodeLength
(
NULL
,
len
),
len
);
if
(
value
)
*
value
=
sdsnewlen
(
p
+
zipEncodeLength
(
NULL
,
len
),
len
);
/* Move list to front when popping from the head */
rlen
=
zipRawEntryLength
(
p
);
...
...
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