X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/603e616bf4e09cdbbfeaf77a5e2a02876c229c35..7585836e6eb1c0199e8d9ea2c3f7a0f67b03c00b:/src/sds.h diff --git a/src/sds.h b/src/sds.h index 91a38782..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(); @@ -74,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