]> git.saurik.com Git - redis.git/blobdiff - src/sds.c
Issue #131. stime/utime reported in INFO was inverted. Fixed thanks to Didier Spezia.
[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);