X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/f9322fb8ed9d47a79a64e7b72485e08f256f2936..e337b260507d12f4a6312aa6c34c2f8a16a732b8:/src/sds.c diff --git a/src/sds.c b/src/sds.c index 82d12e23..bc6aa6b2 100644 --- a/src/sds.c +++ b/src/sds.c @@ -123,6 +123,12 @@ sds sdsRemoveFreeSpace(sds s) { return sh->buf; } +size_t sdsAllocSize(sds s) { + struct sdshdr *sh = (void*) (s-(sizeof(struct sdshdr))); + + return sizeof(*sh)+sh->len+sh->free+1; +} + /* Increment the sds length and decrements the left free space at the * end of the string accordingly to 'incr'. Also set the null term * in the new end of the string.