From 4890e2754c238c51497a19b67fb2458ef108f558 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 27 Aug 2024 16:23:47 -0400 Subject: prelude: Rely more on __has_include() Rather than a bunch of manual fallback macros, just provide a fallback definition that returns false. --- src/fsade.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/fsade.c') diff --git a/src/fsade.c b/src/fsade.c index 11dcd9b..a5073ab 100644 --- a/src/fsade.c +++ b/src/fsade.c @@ -26,10 +26,12 @@ # include #endif -#if BFS_USE_SYS_EXTATTR_H +#if __has_include() # include -#elif BFS_USE_SYS_XATTR_H +# define BFS_USE_EXTATTR true +#elif __has_include() # include +# define BFS_USE_XATTR true #endif /** @@ -344,7 +346,7 @@ int bfs_check_capabilities(const struct BFTW *ftwbuf) { #if BFS_CAN_CHECK_XATTRS -#if BFS_USE_SYS_EXTATTR_H +#if BFS_USE_EXTATTR /** Wrapper for extattr_list_{file,link}. */ static ssize_t bfs_extattr_list(const char *path, enum bfs_type type, int namespace) { @@ -390,13 +392,13 @@ static ssize_t bfs_extattr_get(const char *path, enum bfs_type type, int namespa #endif } -#endif // BFS_USE_SYS_EXTATTR_H +#endif // BFS_USE_EXTATTR int bfs_check_xattrs(const struct BFTW *ftwbuf) { const char *path = fake_at(ftwbuf); ssize_t len; -#if BFS_USE_SYS_EXTATTR_H +#if BFS_USE_EXTATTR len = bfs_extattr_list(path, ftwbuf->type, EXTATTR_NAMESPACE_SYSTEM); if (len <= 0) { len = bfs_extattr_list(path, ftwbuf->type, EXTATTR_NAMESPACE_USER); @@ -432,7 +434,7 @@ int bfs_check_xattr_named(const struct BFTW *ftwbuf, const char *name) { const char *path = fake_at(ftwbuf); ssize_t len; -#if BFS_USE_SYS_EXTATTR_H +#if BFS_USE_EXTATTR len = bfs_extattr_get(path, ftwbuf->type, EXTATTR_NAMESPACE_SYSTEM, name); if (len < 0) { len = bfs_extattr_get(path, ftwbuf->type, EXTATTR_NAMESPACE_USER, name); -- cgit v1.2.3