-char **strv_append(char **l, const char *s) {
- char **r, **k;
-
- if (!l)
- return strv_new(s, NULL);
-
- if (!s)
- return strv_copy(l);
-
- r = new(char*, strv_length(l)+2);
- if (!r)
- return NULL;
-
- for (k = r; *l; k++, l++) {
- *k = strdup(*l);
- if (!*k)
- goto fail;
- }
-
- k[0] = strdup(s);
- if (!k[0])
- goto fail;
-
- k[1] = NULL;
- return r;
-
-fail:
- strv_free(r);
- return NULL;
-}
-
-char **strv_appendf(char **l, const char *format, ...) {
- va_list ap;
- _cleanup_free_ char *s = NULL;
- int r;
-
- va_start(ap, format);
- r = vasprintf(&s, format, ap);
- va_end(ap);
-
- if (r < 0)
- return NULL;
-
- return strv_append(l, s);
-}
-