strv: introduce strv_extendf_with_size()

This commit is contained in:
Yu Watanabe
2025-11-01 00:58:39 +09:00
parent 0885e4a6e7
commit 3c66f40262
3 changed files with 17 additions and 3 deletions
+2 -2
View File
@@ -906,7 +906,7 @@ void strv_print_full(char * const *l, const char *prefix) {
printf("%s%s\n", strempty(prefix), *s);
}
int strv_extendf(char ***l, const char *format, ...) {
int strv_extendf_with_size(char ***l, size_t *n, const char *format, ...) {
va_list ap;
char *x;
int r;
@@ -918,7 +918,7 @@ int strv_extendf(char ***l, const char *format, ...) {
if (r < 0)
return -ENOMEM;
return strv_consume(l, x);
return strv_consume_with_size(l, n, x);
}
char* startswith_strv(const char *s, char * const *l) {