]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
path-util: express PATH_IN_SET() through path_strv_contains()
authorLennart Poettering <lennart@poettering.net>
Wed, 8 Jan 2020 11:23:57 +0000 (12:23 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 9 Jan 2020 10:17:47 +0000 (11:17 +0100)
src/basic/path-util.h

index 3e8c12481be013eada09034e55d60cf5a74d522b..f49a876f3d22d6324b578fb61154f10d695f2911 100644 (file)
@@ -71,17 +71,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__))