]> git.saurik.com Git - redis.git/blobdiff - sds.c
Merge branch 'test_vm' of git://github.com/pietern/redis
[redis.git] / sds.c
diff --git a/sds.c b/sds.c
index 8d1edcb7ec977d9969b9146a436935dcd4c3eb81..feb1a6212e657661dbe0a1de5a9b028b1e79e7af 100644 (file)
--- a/sds.c
+++ b/sds.c
@@ -335,3 +335,25 @@ cleanup:
     }
 #endif
 }
+
+void sdsfreesplitres(sds *tokens, int count) {
+    if (!tokens) return;
+    while(count--)
+        sdsfree(tokens[count]);
+    zfree(tokens);
+}
+
+sds sdsfromlonglong(long long value) {
+    char buf[32], *p;
+    unsigned long long v;
+
+    v = (value < 0) ? -value : value;
+    p = buf+31; /* point to the last character */
+    do {
+        *p-- = '0'+(v%10);
+        v /= 10;
+    } while(v);
+    if (value < 0) *p-- = '-';
+    p++;
+    return sdsnewlen(p,32-(p-buf));
+}