Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
03e52931
Commit
03e52931
authored
May 29, 2010
by
Pieter Noordhuis
Browse files
rename argument names to s* to disambiguate from e*
parent
c8d9e7f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
ziplist.c
View file @
03e52931
...
@@ -384,20 +384,20 @@ unsigned char *ziplistNext(unsigned char *p) {
...
@@ -384,20 +384,20 @@ unsigned char *ziplistNext(unsigned char *p) {
* on the encoding of the entry. 'e' is always set to NULL to be able
* on the encoding of the entry. 'e' is always set to NULL to be able
* to find out whether the string pointer or the integer value was set.
* to find out whether the string pointer or the integer value was set.
* Return 0 if 'p' points to the end of the zipmap, 1 otherwise. */
* Return 0 if 'p' points to the end of the zipmap, 1 otherwise. */
unsigned
int
ziplistGet
(
unsigned
char
*
p
,
unsigned
char
**
e
,
unsigned
int
*
e
len
,
long
long
*
v
)
{
unsigned
int
ziplistGet
(
unsigned
char
*
p
,
unsigned
char
**
sstr
,
unsigned
int
*
s
len
,
long
long
*
sval
)
{
zlentry
entry
;
zlentry
entry
;
if
(
*
p
==
ZIP_END
)
return
0
;
if
(
*
p
==
ZIP_END
)
return
0
;
if
(
e
)
*
e
=
NULL
;
if
(
sstr
)
*
sstr
=
NULL
;
entry
=
zipEntry
(
p
);
entry
=
zipEntry
(
p
);
if
(
entry
.
encoding
==
ZIP_ENC_RAW
)
{
if
(
entry
.
encoding
==
ZIP_ENC_RAW
)
{
if
(
e
)
{
if
(
sstr
)
{
*
e
len
=
entry
.
len
;
*
s
len
=
entry
.
len
;
*
e
=
p
+
entry
.
headersize
;
*
sstr
=
p
+
entry
.
headersize
;
}
}
}
else
{
}
else
{
if
(
v
)
{
if
(
sval
)
{
*
v
=
zipLoadInteger
(
p
+
entry
.
headersize
,
entry
.
encoding
);
*
sval
=
zipLoadInteger
(
p
+
entry
.
headersize
,
entry
.
encoding
);
}
}
}
}
return
1
;
return
1
;
...
@@ -446,7 +446,7 @@ unsigned char *ziplistDelete(unsigned char *zl, unsigned char **p) {
...
@@ -446,7 +446,7 @@ unsigned char *ziplistDelete(unsigned char *zl, unsigned char **p) {
}
}
/* Compare entry pointer to by 'p' with 'entry'. Return 1 if equal. */
/* Compare entry pointer to by 'p' with 'entry'. Return 1 if equal. */
unsigned
int
ziplistCompare
(
unsigned
char
*
p
,
unsigned
char
*
s
,
unsigned
int
slen
)
{
unsigned
int
ziplistCompare
(
unsigned
char
*
p
,
unsigned
char
*
s
str
,
unsigned
int
slen
)
{
zlentry
entry
;
zlentry
entry
;
unsigned
char
sencoding
;
unsigned
char
sencoding
;
long
long
val
,
sval
;
long
long
val
,
sval
;
...
@@ -456,13 +456,13 @@ unsigned int ziplistCompare(unsigned char *p, unsigned char *s, unsigned int sle
...
@@ -456,13 +456,13 @@ unsigned int ziplistCompare(unsigned char *p, unsigned char *s, unsigned int sle
if
(
entry
.
encoding
==
ZIP_ENC_RAW
)
{
if
(
entry
.
encoding
==
ZIP_ENC_RAW
)
{
/* Raw compare */
/* Raw compare */
if
(
entry
.
len
==
slen
)
{
if
(
entry
.
len
==
slen
)
{
return
memcmp
(
p
+
entry
.
headersize
,
s
,
slen
)
==
0
;
return
memcmp
(
p
+
entry
.
headersize
,
s
str
,
slen
)
==
0
;
}
else
{
}
else
{
return
0
;
return
0
;
}
}
}
else
{
}
else
{
/* Try to compare encoded values */
/* Try to compare encoded values */
if
(
zipTryEncoding
(
s
,
&
sval
,
&
sencoding
))
{
if
(
zipTryEncoding
(
s
str
,
&
sval
,
&
sencoding
))
{
if
(
entry
.
encoding
==
sencoding
)
{
if
(
entry
.
encoding
==
sencoding
)
{
val
=
zipLoadInteger
(
p
+
entry
.
headersize
,
entry
.
encoding
);
val
=
zipLoadInteger
(
p
+
entry
.
headersize
,
entry
.
encoding
);
return
val
==
sval
;
return
val
==
sval
;
...
...
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