summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2015-05-04 13:00:02 +0200
committerSalvatore Sanfilippo <antirez@gmail.com>2015-05-04 13:00:02 +0200
commit8af99d0c09324598faf9f8e5b9aa300fc913ff3c (patch)
treedf8808749e438fcda5d623a773e71d73f49d2a95
parent5a23ef88bfada3c1998c51dcb4aba9fdf8ad32b0 (diff)
parent26a1a08fc798fb36c8086138b5f78119aa8c0e21 (diff)
downloadredis-8af99d0c09324598faf9f8e5b9aa300fc913ff3c.tar.gz
Merge pull request #2530 from FuGangqiang/unstable
fix sds.c
-rw-r--r--src/sds.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/sds.c b/src/sds.c
index 05ee0ad56..2ebe286d1 100644
--- a/src/sds.c
+++ b/src/sds.c
@@ -71,7 +71,7 @@ sds sdsempty(void) {
return sdsnewlen("",0);
}
-/* Create a new sds string starting from a null termined C string. */
+/* Create a new sds string starting from a null terminated C string. */
sds sdsnew(const char *init) {
size_t initlen = (init == NULL) ? 0 : strlen(init);
return sdsnewlen(init, initlen);
@@ -557,7 +557,7 @@ sds sdscatfmt(sds s, char const *fmt, ...) {
* Example:
*
* s = sdsnew("AA...AA.a.aa.aHelloWorld :::");
- * s = sdstrim(s,"A. :");
+ * s = sdstrim(s,"Aa. :");
* printf("%s\n", s);
*
* Output will be just "Hello World".
@@ -1098,6 +1098,7 @@ int sdsTest(int argc, char *argv[]) {
unsigned int oldfree;
sdsfree(x);
+ sdsfree(y);
x = sdsnew("0");
sh = (void*) (x-(sizeof(struct sdshdr)));
test_cond("sdsnew() free/len buffers", sh->len == 1 && sh->free == 0);
@@ -1110,6 +1111,8 @@ int sdsTest(int argc, char *argv[]) {
test_cond("sdsIncrLen() -- content", x[0] == '0' && x[1] == '1');
test_cond("sdsIncrLen() -- len", sh->len == 2);
test_cond("sdsIncrLen() -- free", sh->free == oldfree-1);
+
+ sdsfree(x);
}
}
test_report()