X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/24f753a8b996a364273019ea791fe89f87cff678..2ebd2720b37dcca3b6e0c18377bd69e9eaf541fc:/deps/hiredis/sds.h?ds=inline diff --git a/deps/hiredis/sds.h b/deps/hiredis/sds.h index 2c3fb52b..94f5871f 100644 --- a/deps/hiredis/sds.h +++ b/deps/hiredis/sds.h @@ -42,13 +42,24 @@ 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(); +sds sdsempty(void); 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, const void *t, size_t len); sds sdscat(sds s, const char *t); sds sdscpylen(sds s, char *t, size_t len);