From fe3c74983c4ffc00d27e72cd76785f7bf2fefb47 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Mon, 3 Aug 2020 23:47:18 +0200 Subject: dynstr_prepend(), fixed typo in comment --- include/dynstr.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'include/dynstr.h') diff --git a/include/dynstr.h b/include/dynstr.h index dcdd8a1..7283de5 100644 --- a/include/dynstr.h +++ b/include/dynstr.h @@ -48,7 +48,7 @@ #define dynstr_append_or_ret_zero(...) if (dynstr_append(__VA_ARGS__) != DYNSTR_OK) return 0 /** - * Convenience macro that calls dynstr_append and returns zero if failed. + * Convenience macro that calls dynstr_append and returns one if failed. */ #define dynstr_append_or_ret_nonzero(...) if (dynstr_append(__VA_ARGS__) != DYNSTR_OK) return 1 @@ -95,6 +95,18 @@ void dynstr_init(struct dynstr *d); */ enum dynstr_err dynstr_append(struct dynstr *d, const char *format, ...); +/** + * This function takes a string literal in printf format and a variable + * number of arguments, calculates its size and prepends it into the + * beginning of the dynamic string. + * @param d Dynamic string where new string will be prepended. + * @param format String literal in printf format. + * @return Returns one of the following error codes: + * # DYNSTR_OK if successful. + * # DYNSTR_ERR_ALLOC if no more memory is available. + */ +enum dynstr_err dynstr_prepend(struct dynstr *d, const char *format, ...); + /** * This function duplicates a dynamic string to another instance. * @attention Destination instance must be initialized before calling -- cgit v1.2.3