diff options
Diffstat (limited to 'src/shared/strv.c')
-rw-r--r-- | src/shared/strv.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/shared/strv.c b/src/shared/strv.c index 67706dc381..1ef0b26a25 100644 --- a/src/shared/strv.c +++ b/src/shared/strv.c @@ -527,3 +527,18 @@ void strv_print(char **l) { STRV_FOREACH(s, l) puts(*s); } + +int strv_extendf(char ***l, const char *format, ...) { + va_list ap; + char *x; + int r; + + va_start(ap, format); + r = vasprintf(&x, format, ap); + va_end(ap); + + if (r < 0) + return -ENOMEM; + + return strv_consume(l, x); +} |