X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/0681c5ad844cefefbe62f30df6587c0cbec3272e..29177b4d08eff23300b1e4c9a4ae358f05554dbb:/src/sds.c diff --git a/src/sds.c b/src/sds.c index 2ec7c3cb..77052966 100644 --- 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);