mirror of https://github.com/redis/redis.git
Add sdsfreeusable()
This commit is contained in:
parent
2e4a7cc991
commit
937835b4b6
10
src/sds.c
10
src/sds.c
|
|
@ -216,6 +216,16 @@ void sdsfree(sds s) {
|
|||
s_free((char*)s-sdsHdrSize(s[-1]));
|
||||
}
|
||||
|
||||
/* Free an sds string. No operation is performed if 's' is NULL.
|
||||
* '*usable' is set to the usable size if non NULL */
|
||||
void sdsfreeusable(sds s, size_t *usable) {
|
||||
if (s == NULL) {
|
||||
if (usable) *usable = 0;
|
||||
return;
|
||||
}
|
||||
s_free_usable((char*)s-sdsHdrSize(s[-1]), usable);
|
||||
}
|
||||
|
||||
/* Generic version of sdsfree. */
|
||||
void sdsfreegeneric(void *s) {
|
||||
sdsfree((sds)s);
|
||||
|
|
|
|||
|
|
@ -218,6 +218,7 @@ sds sdsnewplacement(char *buf, size_t bufsize, char type, const char *init, size
|
|||
sds sdsempty(void);
|
||||
sds sdsdup(const sds s);
|
||||
void sdsfree(sds s);
|
||||
void sdsfreeusable(sds s, size_t *usable);
|
||||
void sdsfreegeneric(void *s);
|
||||
sds sdsgrowzero(sds s, size_t len);
|
||||
sds sdscatlen(sds s, const void *t, size_t len);
|
||||
|
|
|
|||
Loading…
Reference in New Issue