mirror of
https://github.com/systemd/systemd.git
synced 2025-01-25 10:04:04 +03:00
path-util: introduce path_strv_contains() helper
it's like strv_contains() but uses path_equal() rather than streq() to compare strings.
This commit is contained in:
parent
125c7814fa
commit
3841fee822
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user