From d89b7953c0c3409d8debd3b98430a4d2f5f83fed Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Sat, 17 Jan 2015 23:41:13 +0100 Subject: sds.h: Add inline function for getting the sdshdr --- src/sds.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/sds.h b/src/sds.h index 9b81489..ac99b80 100644 --- a/src/sds.h +++ b/src/sds.h @@ -41,6 +41,10 @@ struct sdshdr { char buf[]; }; +static inline struct sdshdr * sdsheader(const sds s) { + return s - (sizeof (struct sdshdr)); +} + static inline size_t sdslen(const sds s) { struct sdshdr *sh = s - (sizeof (struct sdshdr)); return sh->len; -- cgit v1.2.3-70-g09d2