X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/60361e5aac5b06ab06f4a63439ce84cd58c87f3d..3f7b2b1f300e6d0441f420fcb51c253b10631cfa:/src/sds.h diff --git a/src/sds.h b/src/sds.h index ae0f84fb..ea43f868 100644 --- a/src/sds.h +++ b/src/sds.h @@ -42,6 +42,16 @@ struct sdshdr { char buf[]; }; +static inline size_t sdslen(const sds s) { + struct sdshdr *sh = (void*)(s-(sizeof(struct sdshdr))); + return sh->len; +} + +static inline size_t sdsavail(const sds s) { + struct sdshdr *sh = (void*)(s-(sizeof(struct sdshdr))); + return sh->free; +} + sds sdsnewlen(const void *init, size_t initlen); sds sdsnew(const char *init); sds sdsempty(); @@ -49,6 +59,7 @@ size_t sdslen(const sds s); sds sdsdup(const sds s); void sdsfree(sds s); size_t sdsavail(sds s); +sds sdsgrowzero(sds s, size_t len); sds sdscatlen(sds s, void *t, size_t len); sds sdscat(sds s, char *t); sds sdscpylen(sds s, char *t, size_t len); @@ -73,5 +84,6 @@ void sdstoupper(sds s); sds sdsfromlonglong(long long value); sds sdscatrepr(sds s, char *p, size_t len); sds *sdssplitargs(char *line, int *argc); +void sdssplitargs_free(sds *argv, int argc); #endif