diff options
Diffstat (limited to 'source/blender/blenlib/BLI_string_utils.h')
-rw-r--r-- | source/blender/blenlib/BLI_string_utils.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/blenlib/BLI_string_utils.h b/source/blender/blenlib/BLI_string_utils.h index 13dbb2de659..7b0dd13e0c7 100644 --- a/source/blender/blenlib/BLI_string_utils.h +++ b/source/blender/blenlib/BLI_string_utils.h @@ -31,7 +31,7 @@ extern "C" { #endif #include "BLI_compiler_attrs.h" -#include "BLI_utildefines_variadic.h" +#include "BLI_utildefines.h" struct ListBase; @@ -44,6 +44,16 @@ void BLI_string_split_suffix(const char *string, char *r_body, char *r_suf, cons void BLI_string_split_prefix(const char *string, char *r_pre, char *r_body, const size_t str_len); /* Join strings, return newly allocated string. */ +char *BLI_string_join_array(char *result, + size_t result_len, + const char *strings[], + uint strings_len) ATTR_NONNULL(); +char *BLI_string_join_array_by_sep_char(char *result, + size_t result_len, + char sep, + const char *strings[], + uint strings_len) ATTR_NONNULL(); + char *BLI_string_join_arrayN(const char *strings[], uint strings_len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); char *BLI_string_join_array_by_sep_charN(char sep, @@ -54,6 +64,9 @@ char *BLI_string_join_array_by_sep_char_with_tableN(char sep, const char *strings[], uint strings_len) ATTR_NONNULL(); /* Take multiple arguments, pass as (array, length). */ +#define BLI_string_join(result, result_len, ...) \ + BLI_string_join_array( \ + result, result_len, ((const char *[]){__VA_ARGS__}), VA_NARGS_COUNT(__VA_ARGS__)) #define BLI_string_joinN(...) \ BLI_string_join_arrayN(((const char *[]){__VA_ARGS__}), VA_NARGS_COUNT(__VA_ARGS__)) #define BLI_string_join_by_sep_charN(sep, ...) \ |