diff options
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/strv.c | 15 | ||||
-rw-r--r-- | src/shared/strv.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/shared/strv.c b/src/shared/strv.c index 6b76d0eaef..aed45d2612 100644 --- a/src/shared/strv.c +++ b/src/shared/strv.c @@ -370,6 +370,21 @@ fail: return NULL; } +int strv_extend(char ***l, const char *value) { + char **c; + + if (!value) + return 0; + + c = strv_append(*l, value); + if (!c) + return -ENOMEM; + + strv_free(*l); + *l = c; + return 0; +} + char **strv_uniq(char **l) { char **i; diff --git a/src/shared/strv.h b/src/shared/strv.h index 45558d8960..44ba3d1530 100644 --- a/src/shared/strv.h +++ b/src/shared/strv.h @@ -37,6 +37,7 @@ unsigned strv_length(char **l); char **strv_merge(char **a, char **b); char **strv_merge_concat(char **a, char **b, const char *suffix); char **strv_append(char **l, const char *s); +int strv_extend(char ***l, const char *value); char **strv_remove(char **l, const char *s); char **strv_remove_prefix(char **l, const char *s); |