strv: add strv_copy_n() helper for copying part of a n strv

This commit is contained in:
Lennart Poettering
2023-02-17 09:55:35 +01:00
parent f4ff3e7149
commit 4ea517a6e0
3 changed files with 52 additions and 3 deletions
+4 -1
View File
@@ -29,7 +29,10 @@ char** strv_free_erase(char **l);
DEFINE_TRIVIAL_CLEANUP_FUNC(char**, strv_free_erase);
#define _cleanup_strv_free_erase_ _cleanup_(strv_free_erasep)
char** strv_copy(char * const *l);
char** strv_copy_n(char * const *l, size_t n);
static inline char** strv_copy(char * const *l) {
return strv_copy_n(l, SIZE_MAX);
}
size_t strv_length(char * const *l) _pure_;
int strv_extend_strv(char ***a, char * const *b, bool filter_duplicates);