diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-02-16 15:41:55 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2023-02-17 09:55:35 +0100 |
commit | 4ea517a6e07f47117348c68c6fe087bf6d401558 (patch) | |
tree | 1fa110ee7ee35a2c987c6e19f37d3c0606a91931 /src/basic/strv.h | |
parent | f4ff3e71493dbc6ace5d942aa544b1c829763710 (diff) | |
download | systemd-4ea517a6e07f47117348c68c6fe087bf6d401558.tar.gz |
strv: add strv_copy_n() helper for copying part of a n strv
Diffstat (limited to 'src/basic/strv.h')
-rw-r--r-- | src/basic/strv.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/basic/strv.h b/src/basic/strv.h index 1f8da85fcc..71ff3a4edf 100644 --- a/src/basic/strv.h +++ b/src/basic/strv.h @@ -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); |