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
cc209063
Commit
cc209063
authored
Dec 10, 2010
by
Pieter Noordhuis
Browse files
Change function name to match what it does
parent
586500c0
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/sds.c
View file @
cc209063
...
...
@@ -117,8 +117,8 @@ static sds sdsMakeRoomFor(sds s, size_t addlen) {
}
/* Grow the sds to have the specified length. Bytes that were not part of
* the original length of the sds will be set to
NULL
. */
sds
sdsgrow
safe
(
sds
s
,
size_t
len
)
{
* the original length of the sds will be set to
zero
. */
sds
sdsgrow
zero
(
sds
s
,
size_t
len
)
{
struct
sdshdr
*
sh
=
(
void
*
)(
s
-
(
sizeof
(
struct
sdshdr
)));
size_t
totlen
,
curlen
=
sh
->
len
;
...
...
@@ -128,7 +128,7 @@ sds sdsgrowsafe(sds s, size_t len) {
/* Make sure added region doesn't contain garbage */
sh
=
(
void
*
)(
s
-
(
sizeof
(
struct
sdshdr
)));
memset
(
s
+
curlen
,
0
,(
len
-
curlen
+
1
));
/* also set trailing
NULL
byte */
memset
(
s
+
curlen
,
0
,(
len
-
curlen
+
1
));
/* also set trailing
\0
byte */
totlen
=
sh
->
len
+
sh
->
free
;
sh
->
len
=
len
;
sh
->
free
=
totlen
-
sh
->
len
;
...
...
src/sds.h
View file @
cc209063
...
...
@@ -49,7 +49,7 @@ size_t sdslen(const sds s);
sds
sdsdup
(
const
sds
s
);
void
sdsfree
(
sds
s
);
size_t
sdsavail
(
sds
s
);
sds
sdsgrow
safe
(
sds
s
,
size_t
len
);
sds
sdsgrow
zero
(
sds
s
,
size_t
len
);
sds
sdscatlen
(
sds
s
,
void
*
t
,
size_t
len
);
sds
sdscat
(
sds
s
,
char
*
t
);
sds
sdscpylen
(
sds
s
,
char
*
t
,
size_t
len
);
...
...
src/t_string.c
View file @
cc209063
...
...
@@ -139,7 +139,7 @@ void setbitCommand(redisClient *c) {
byte
=
bitoffset
>>
3
;
bit
=
7
-
(
bitoffset
&
0x7
);
on
=
bitvalue
&
0x1
;
o
->
ptr
=
sdsgrow
safe
(
o
->
ptr
,
byte
+
1
);
o
->
ptr
=
sdsgrow
zero
(
o
->
ptr
,
byte
+
1
);
((
char
*
)
o
->
ptr
)[
byte
]
|=
on
<<
bit
;
((
char
*
)
o
->
ptr
)[
byte
]
&=
~
((
!
on
)
<<
bit
);
...
...
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