From 84ee8268c7a635cbbc4327bac20dab82d66ff9c3 Mon Sep 17 00:00:00 2001 From: Sun He Date: Sun, 2 Nov 2014 10:40:28 +0800 Subject: [PATCH 1/3] sds.c: Correct some comments --- src/sds.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sds.c b/src/sds.c index 0ad925b4..36ae56c9 100644 --- a/src/sds.c +++ b/src/sds.c @@ -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 lenght of the null-terminated string + * The function returns the lengh of the null-terminated string * representation stored at 's'. */ #define SDS_LLSTR_SIZE 21 int sdsll2str(char *s, long long value) { @@ -415,7 +415,7 @@ sds sdscatvprintf(sds s, const char *fmt, va_list ap) { * * Example: * - * s = sdsempty("Sum is: "); + * s = sdsnew("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 From bea45da07aff43e9694a14317dc555bef4e39ef6 Mon Sep 17 00:00:00 2001 From: Sun He Date: Sun, 2 Nov 2014 10:42:26 +0800 Subject: [PATCH 2/3] sds.c/sdscatvprintf: set va_end to finish va_list cpy --- src/sds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sds.c b/src/sds.c index 36ae56c9..6370a25e 100644 --- a/src/sds.c +++ b/src/sds.c @@ -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; From 0f706adc5c2270e1084bba88279b844a91233c33 Mon Sep 17 00:00:00 2001 From: Sun He Date: Mon, 3 Nov 2014 17:21:54 +0800 Subject: [PATCH 3/3] sds.c: Correct two spelling mistakes in comments --- src/sds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sds.c b/src/sds.c index 6370a25e..5a3bc82b 100644 --- a/src/sds.c +++ b/src/sds.c @@ -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 lengh of the null-terminated string + * The function returns the length 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 sdscatprintf() 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;