diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/basic/path-util.c | 10 | ||||
-rw-r--r-- | src/basic/path-util.h | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/basic/path-util.c b/src/basic/path-util.c index f1be8d0988..49a211a527 100644 --- a/src/basic/path-util.c +++ b/src/basic/path-util.c @@ -1115,3 +1115,13 @@ bool empty_or_root(const char *root) { return root[strspn(root, "/")] == 0; } + +bool path_strv_contains(char **l, const char *path) { + char **i; + + STRV_FOREACH(i, l) + if (path_equal(*i, path)) + return true; + + return false; +} diff --git a/src/basic/path-util.h b/src/basic/path-util.h index 111d85d445..3e8c12481b 100644 --- a/src/basic/path-util.h +++ b/src/basic/path-util.h @@ -181,3 +181,5 @@ bool empty_or_root(const char *root); static inline const char *empty_to_root(const char *path) { return isempty(path) ? "/" : path; } + +bool path_strv_contains(char **l, const char *path); |