return strv_consume_with_size(l, n, v);
}
-int strv_extend_front(char ***l, const char *value) {
- size_t n, m;
- char *v, **c;
-
- assert(l);
-
- /* Like strv_extend(), but prepends rather than appends the new entry */
-
- if (!value)
- return 0;
-
- n = strv_length(*l);
-
- /* Increase and overflow check. */
- m = n + 2;
- if (m < n)
- return -ENOMEM;
-
- v = strdup(value);
- if (!v)
- return -ENOMEM;
-
- c = reallocarray(*l, m, sizeof(char*));
- if (!c) {
- free(v);
- return -ENOMEM;
- }
-
- memmove(c+1, c, n * sizeof(char*));
- c[0] = v;
- c[n+1] = NULL;
-
- *l = c;
- return 0;
-}
-
char** strv_uniq(char **l) {
/* Drops duplicate entries. The first identical string will be
* kept, the others dropped */
}
int strv_extendf(char ***l, const char *format, ...) _printf_(2,3);
-int strv_extend_front(char ***l, const char *value);
int strv_push_with_size(char ***l, size_t *n, char *value);
static inline int strv_push(char ***l, char *value) {