strv: add helper to extend strv from both sides
Also, use the more correct type of 'const char* const*' for the input strv. This requires adding the cast in a few places, but also allows to remove some casts in others.
This commit is contained in:
+2
-2
@@ -242,13 +242,13 @@ rollback:
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
int strv_extend_strv_concat(char ***a, char * const *b, const char *suffix) {
|
||||
int strv_extend_strv_biconcat(char ***a, const char *prefix, const char* const *b, const char *suffix) {
|
||||
int r;
|
||||
|
||||
STRV_FOREACH(s, b) {
|
||||
char *v;
|
||||
|
||||
v = strjoin(*s, suffix);
|
||||
v = strjoin(strempty(prefix), *s, suffix);
|
||||
if (!v)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user