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
c58db75a
Commit
c58db75a
authored
Dec 09, 2014
by
Salvatore Sanfilippo
Browse files
Merge pull request #2119 from sunheehnus/unstable
sds.c/sdscatvprintf: va_end needs to be fixed
parents
5f5a9f0d
0f706adc
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/sds.c
View file @
c58db75a
...
...
@@ -295,7 +295,7 @@ sds sdscpy(sds s, const char *t) {
* conversion. 's' must point to a string with room for at least
* SDS_LLSTR_SIZE bytes.
*
* The function returns the leng
h
t of the null-terminated string
* The function returns the lengt
h
of the null-terminated string
* representation stored at 's'. */
#define SDS_LLSTR_SIZE 21
int
sdsll2str
(
char
*
s
,
long
long
value
)
{
...
...
@@ -369,7 +369,7 @@ sds sdsfromlonglong(long long value) {
return
sdsnewlen
(
buf
,
len
);
}
/* Like sdscatpritf() but gets va_list instead of being variadic. */
/* Like sdscatpri
n
tf() but gets va_list instead of being variadic. */
sds
sdscatvprintf
(
sds
s
,
const
char
*
fmt
,
va_list
ap
)
{
va_list
cpy
;
char
staticbuf
[
1024
],
*
buf
=
staticbuf
,
*
t
;
...
...
@@ -390,7 +390,7 @@ sds sdscatvprintf(sds s, const char *fmt, va_list ap) {
buf
[
buflen
-
2
]
=
'\0'
;
va_copy
(
cpy
,
ap
);
vsnprintf
(
buf
,
buflen
,
fmt
,
cpy
);
va_end
(
ap
);
va_end
(
cpy
);
if
(
buf
[
buflen
-
2
]
!=
'\0'
)
{
if
(
buf
!=
staticbuf
)
zfree
(
buf
);
buflen
*=
2
;
...
...
@@ -415,7 +415,7 @@ sds sdscatvprintf(sds s, const char *fmt, va_list ap) {
*
* Example:
*
* s = sds
empty
("Sum is: ");
* s = sds
new
("Sum is: ");
* s = sdscatprintf(s,"%d+%d = %d",a,b,a+b).
*
* Often you need to create a string from scratch with the printf-alike
...
...
@@ -643,8 +643,8 @@ void sdstoupper(sds s) {
*
* Return value:
*
*
1
if s1 > s2.
*
-1
if s1 < s2.
*
positive
if s1 > s2.
*
negative
if s1 < s2.
* 0 if s1 and s2 are exactly the same binary string.
*
* If two strings share exactly the same prefix, but one of the two has
...
...
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