X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/12d090d2d0a9ff8d2c082b97cf405a30c7126752..fdfb02e7ff6e25f94dda2e649c18fa4addac4cc4:/sds.c diff --git a/sds.c b/sds.c index 8d1edcb7..feb1a621 100644 --- 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)); +}