From d64db6bad79e10f92c56e5572d6ae9072d62b3a3 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Fri, 1 Feb 2019 00:04:33 -0500 Subject: Add some documentation comments --- dstring.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'dstring.c') diff --git a/dstring.c b/dstring.c index f4a865a..10e1557 100644 --- a/dstring.c +++ b/dstring.c @@ -27,10 +27,12 @@ struct dstring { char data[]; }; +/** Get the string header from the string data pointer. */ static struct dstring *dstrheader(const char *dstr) { return (struct dstring *)(dstr - offsetof(struct dstring, data)); } +/** Get the correct size for a dstring with the given capacity. */ static size_t dstrsize(size_t capacity) { return sizeof(struct dstring) + capacity + 1; } @@ -81,6 +83,7 @@ int dstresize(char **dstr, size_t length) { return 0; } +/** Common implementation of dstr{cat,ncat,app}. */ static int dstrcat_impl(char **dest, const char *src, size_t srclen) { size_t oldlen = dstrlen(*dest); size_t newlen = oldlen + srclen; -- cgit v1.2.3