string-util: make strjoin() just a special case of strextend()

The functions are very similar, let's make them the same. If the first
argument to strextend() is NULL instead of extending a string we'll
allocate a fresh one and return that.
This commit is contained in:
Lennart Poettering
2025-01-15 10:51:53 +01:00
parent 9a0776159b
commit 34467ffa3c
2 changed files with 10 additions and 38 deletions
+1 -2
View File
@@ -108,8 +108,7 @@ char* first_word(const char *s, const char *word) _pure_;
char* strnappend(const char *s, const char *suffix, size_t length);
char* strjoin_real(const char *x, ...) _sentinel_;
#define strjoin(a, ...) strjoin_real((a), __VA_ARGS__, NULL)
#define strjoin(a, ...) strextend_with_separator_internal(NULL, NULL, a, __VA_ARGS__, NULL)
#define strjoina(a, ...) \
({ \