]> git.saurik.com Git - redis.git/blobdiff - src/sds.c
Added two new tests for RENAME, currently both will fail because of bug #128.
[redis.git] / src / sds.c
index 2ec7c3cb76b3a2d6f5afdb3be8bd6aa793329a1c..77052966ceb79e72355df042f400648d35131829 100644 (file)
--- a/src/sds.c
+++ b/src/sds.c
@@ -94,6 +94,13 @@ void sdsupdatelen(sds s) {
     sh->len = reallen;
 }
 
+void sdsclear(sds s) {
+    struct sdshdr *sh = (void*) (s-(sizeof(struct sdshdr)));
+    sh->free += sh->len;
+    sh->len = 0;
+    sh->buf[0] = '\0';
+}
+
 static sds sdsMakeRoomFor(sds s, size_t addlen) {
     struct sdshdr *sh, *newsh;
     size_t free = sdsavail(s);