From bffb40f1516067d4eee1e072a34702f24c30fd47 Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Tue, 25 Aug 2020 13:35:29 +0200 Subject: doc(stringutil): init docs --- TODO | 1 - stringutil.h | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) 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, ...); -- cgit 1.4.1