string-util: introduce strprepend_with_separator()

This commit is contained in:
Mike Yuan
2025-06-11 12:50:51 +09:00
committed by Yu Watanabe
parent 9217a6ffa3
commit d9bf815093
4 changed files with 24 additions and 23 deletions
-14
View File
@@ -40,20 +40,6 @@ char* first_word(const char *s, const char *word) {
return (char*) nw;
}
char* strprepend(char **x, const char *s) {
assert(x);
if (isempty(s) && *x)
return *x;
char *p = strjoin(strempty(s), *x);
if (!p)
return NULL;
free_and_replace(*x, p);
return *x;
}
char* strextendn(char **x, const char *s, size_t l) {
assert(x);
assert(s || l == 0);