aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2015-01-17 23:41:13 +0100
committerJohannes Löthberg <johannes@kyriasis.com>2015-01-17 23:41:13 +0100
commitd89b7953c0c3409d8debd3b98430a4d2f5f83fed (patch)
treee31bcf49e6cb6e2d9fe75eb8aeb5bd479e159443 /src
parentbce31907c030849f85c7777a53052fef31f80515 (diff)
downloadsds-d89b7953c0c3409d8debd3b98430a4d2f5f83fed.tar.xz
sds.h: Add inline function for getting the sdshdr
Diffstat (limited to 'src')
-rw-r--r--src/sds.h4
1 files changed, 4 insertions, 0 deletions
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;