mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
sds.c: sdsAllocSize() function added.
This commit is contained in:
parent
9555f8f21b
commit
739803c064
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user