about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2020-08-25 13:35:29 +0200
committersternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2020-08-25 13:35:29 +0200
commitbffb40f1516067d4eee1e072a34702f24c30fd47 (patch)
treee6d008d0e84a12e82dab13c5d4955b0f481c7809
parentb50d7870ed25fbbe8533f3bb1311ea2b1307517a (diff)
doc(stringutil): init docs
-rw-r--r--TODO1
-rw-r--r--stringutil.h25
2 files changed, 25 insertions, 1 deletions
diff --git a/TODO b/TODO
index 0a8686f..b17fc5d 100644
--- a/TODO
+++ b/TODO
@@ -6,4 +6,3 @@ tests for xml.c | id:b9e91d022be6bdc70e7ab082743826370b713c72
 improve man3 situation | id:bf918930f6361c30f288c42894cbf9b0541c3340
 use errno instead of returning HTTP status codes in make_index | id:bfa35c48dcedbecd3a951eba243c4840178289ed
 sandboxing, at least chroot | id:f209aec893fe310c8276f64f6ff4a3208a2a4f28
-document stringutil | id:fd05b97115848a8b22231a477b8252373bd87264
diff --git a/stringutil.h b/stringutil.h
index ddfebfc..c7cb40d 100644
--- a/stringutil.h
+++ b/stringutil.h
@@ -1,2 +1,27 @@
+/*!
+ * @file
+ * @brief Utilities for string construction
+ */
+
+/*!
+ * @brief Returns hex digit for given integer
+ *
+ * Will return appropriate `char` in range 0-F
+ * for input in range 0-15. Can be abused to
+ * return decimal digits for range 0-9.
+ */
 char nibble_hex(short h);
+
+/*!
+ * @brief Concatenate arbitrary number of strings into
+ * dynamically allocated buffer
+ *
+ * catn_alloc() concats the `n` given strings into a
+ * dynamically allocated and resized buffer and returns
+ * it. This buffer must be cleaned up by `free()` before
+ * it goes out of scope.
+ *
+ * @param n number of strings given as `va_args`
+ * @return pointer to concatenated strings or `NULL` on error.
+ */
 char *catn_alloc(size_t n, ...);