diff options
author | Campbell Barton <campbell@blender.org> | 2022-11-03 06:17:54 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-11-03 06:32:50 +0300 |
commit | 92b2f4d24999d463d20e7a134bff414f0a8a9d77 (patch) | |
tree | eab2c16e77f7592288eba55117c8ebc1bb5f10f4 /source/blender/blenlib/intern | |
parent | 5ba045af7b3bebf2e4a7e1098f35ad134fbd78e8 (diff) |
BLI_string: C++ support for string joining macros
C++ doesn't support taking the temporary address of a temporary array,
use inline functions instead.
Also change array joining functions to return the length of the string
instead of returning the pointer (matching BLI_path_join).
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/string_utils.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/blenlib/intern/string_utils.c b/source/blender/blenlib/intern/string_utils.c index 0b9baaff3e9..27734d2f429 100644 --- a/source/blender/blenlib/intern/string_utils.c +++ b/source/blender/blenlib/intern/string_utils.c @@ -344,10 +344,10 @@ bool BLI_uniquename( * * \{ */ -char *BLI_string_join_array(char *result, - size_t result_len, - const char *strings[], - uint strings_len) +size_t BLI_string_join_array(char *result, + size_t result_len, + const char *strings[], + uint strings_len) { char *c = result; char *c_end = &result[result_len - 1]; @@ -358,10 +358,10 @@ char *BLI_string_join_array(char *result, } } *c = '\0'; - return c; + return (size_t)(c - result); } -char *BLI_string_join_array_by_sep_char( +size_t BLI_string_join_array_by_sep_char( char *result, size_t result_len, char sep, const char *strings[], uint strings_len) { char *c = result; @@ -378,7 +378,7 @@ char *BLI_string_join_array_by_sep_char( } } *c = '\0'; - return c; + return (size_t)(c - result); } char *BLI_string_join_arrayN(const char *strings[], uint strings_len) |