diff options
Diffstat (limited to 'src/basic')
-rw-r--r-- | src/basic/strv.c | 12 | ||||
-rw-r--r-- | src/basic/strv.h | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/basic/strv.c b/src/basic/strv.c index 92f900936e..9524e80a6f 100644 --- a/src/basic/strv.c +++ b/src/basic/strv.c @@ -733,3 +733,15 @@ char ***strv_free_free(char ***l) { free(l); return NULL; } + +char **strv_skip(char **l, size_t n) { + + while (n > 0) { + if (strv_isempty(l)) + return l; + + l++, n--; + } + + return l; +} diff --git a/src/basic/strv.h b/src/basic/strv.h index 713e91f8f8..4c4b6526de 100644 --- a/src/basic/strv.h +++ b/src/basic/strv.h @@ -156,3 +156,5 @@ static inline bool strv_fnmatch_or_empty(char* const* patterns, const char *s, i } char ***strv_free_free(char ***l); + +char **strv_skip(char **l, size_t n); |