summaryrefslogtreecommitdiffstats
path: root/dstring.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2019-02-01 00:04:33 -0500
committerTavian Barnes <tavianator@tavianator.com>2019-02-09 17:06:38 -0500
commitd64db6bad79e10f92c56e5572d6ae9072d62b3a3 (patch)
treef1f334c165afecd1907e9c4cf377878ba172c35a /dstring.c
parent563b5f9d48e54dc2f5d61a23ce2171e005da201a (diff)
downloadbfs-d64db6bad79e10f92c56e5572d6ae9072d62b3a3.tar.xz
Add some documentation comments
Diffstat (limited to 'dstring.c')
-rw-r--r--dstring.c3
1 files changed, 3 insertions, 0 deletions
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;