X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=src%2Fcommon%2Fstring-utils%2Fstring-utils.h;h=57cf4ecbfb5ae2316b2af392be9a348bd18bf655;hb=4971b7f0243bd3a7a661bcf1cfe95f0f8014b59b;hp=fb795b9ddf9a5bec07e63da880da75788995e2d1;hpb=48a4000561343808724f7cb5fa8c131877489ccd;p=lttng-tools.git diff --git a/src/common/string-utils/string-utils.h b/src/common/string-utils/string-utils.h index fb795b9dd..57cf4ecbf 100644 --- a/src/common/string-utils/string-utils.h +++ b/src/common/string-utils/string-utils.h @@ -12,10 +12,6 @@ #include #include -#if defined(__cplusplus) -extern "C" { -#endif - void strutils_normalize_star_glob_pattern(char *pattern); bool strutils_is_star_glob_pattern(const char *pattern); @@ -31,8 +27,21 @@ void strutils_free_null_terminated_array_of_strings(char **array); size_t strutils_array_of_strings_len(char * const *array); -#if defined(__cplusplus) -} -#endif +/* + * Append `append` to the malloc-end string `str`. + * + * On success, `str` is free'd (if not NULL) and assigned a new malloc-ed + * string. On failure, `str` is not modified. + * + * Return 0 on success, -ENOMEM on failure. + */ +C_LINKAGE int strutils_append_str(char **str, const char *append); + +/* + * Like `strutils_append_str`, but the appended string is formatted using + * `fmt` and the following arguments. + */ +C_LINKAGE ATTR_FORMAT_PRINTF(2, 3) +int strutils_appendf(char **s, const char *fmt, ...); #endif /* _STRING_UTILS_H */