diff options
| author | Sebastien Bacher <seb128@ubuntu.com> | 2020-05-19 16:38:36 +0200 |
|---|---|---|
| committer | Sebastien Bacher <seb128@ubuntu.com> | 2020-05-19 17:09:07 +0200 |
| commit | ccf6dc06bbee82c3d49f451545c5317337e0777e (patch) | |
| tree | a8fddc8c6e2b3b99bebab1d5bb2a64581eff4bfd /shared/systemd/src/basic/path-util.h | |
| parent | f109e55ef130ce84054d5ba3acf4b71cd8c7564a (diff) | |
| parent | 7ffed1e6136de75188f10ba8763bcb942f932f8e (diff) | |
Merge remote-tracking branch 'salsa/debian/master' into ubuntu/master
Diffstat (limited to 'shared/systemd/src/basic/path-util.h')
| -rw-r--r-- | shared/systemd/src/basic/path-util.h | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/shared/systemd/src/basic/path-util.h b/shared/systemd/src/basic/path-util.h index 88aef2f3..aba8ad00 100644 --- a/shared/systemd/src/basic/path-util.h +++ b/shared/systemd/src/basic/path-util.h @@ -73,17 +73,7 @@ static inline bool path_equal_ptr(const char *a, const char *b) { } /* Note: the search terminates on the first NULL item. */ -#define PATH_IN_SET(p, ...) \ - ({ \ - char **_s; \ - bool _found = false; \ - STRV_FOREACH(_s, STRV_MAKE(__VA_ARGS__)) \ - if (path_equal(p, *_s)) { \ - _found = true; \ - break; \ - } \ - _found; \ - }) +#define PATH_IN_SET(p, ...) path_strv_contains(STRV_MAKE(__VA_ARGS__), p) char* path_startswith_strv(const char *p, char **set); #define PATH_STARTSWITH_SET(p, ...) path_startswith_strv(p, STRV_MAKE(__VA_ARGS__)) @@ -183,3 +173,6 @@ 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); +bool prefixed_path_strv_contains(char **l, const char *path); |