From 6cfd4d5d7b5c5cbbf13c96a8980353dce88afcf3 Mon Sep 17 00:00:00 2001 From: Adam Knight Date: Wed, 5 Apr 2017 14:04:15 -0500 Subject: [PATCH] Clean up some cpp logic for __APPLE__ --- src/fs_base_getxattr.hpp | 8 +++----- src/fs_base_listxattr.hpp | 8 +++----- src/fs_base_removexattr.hpp | 8 +++----- src/fs_base_setxattr.hpp | 8 +++----- 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/fs_base_getxattr.hpp b/src/fs_base_getxattr.hpp index b0ec163b..0a4b2f41 100644 --- a/src/fs_base_getxattr.hpp +++ b/src/fs_base_getxattr.hpp @@ -34,14 +34,12 @@ namespace fs void *value, const size_t size) { -#ifndef WITHOUT_XATTR -#if __APPLE__ +#if WITHOUT_XATTR + return (errno=ENOTSUP,-1); +#elif __APPLE__ return ::getxattr(path.c_str(),attrname,value,size,0,XATTR_NOFOLLOW); #else return ::lgetxattr(path.c_str(),attrname,value,size); -#endif /* __APPLE__ */ -#else - return (errno=ENOTSUP,-1); #endif } } diff --git a/src/fs_base_listxattr.hpp b/src/fs_base_listxattr.hpp index 1ce6020d..8de8518a 100644 --- a/src/fs_base_listxattr.hpp +++ b/src/fs_base_listxattr.hpp @@ -33,14 +33,12 @@ namespace fs char *list, const size_t size) { -#ifndef WITHOUT_XATTR -#if __APPLE__ +#ifdef WITHOUT_XATTR + return (errno=ENOTSUP,-1); +#elif __APPLE__ return ::listxattr(path.c_str(),list,size,XATTR_NOFOLLOW); #else return ::llistxattr(path.c_str(),list,size); -#endif /* __APPLE__ */ -#else - return (errno=ENOTSUP,-1); #endif } } diff --git a/src/fs_base_removexattr.hpp b/src/fs_base_removexattr.hpp index 0dc6436a..1513354d 100644 --- a/src/fs_base_removexattr.hpp +++ b/src/fs_base_removexattr.hpp @@ -32,14 +32,12 @@ namespace fs lremovexattr(const std::string &path, const char *attrname) { -#ifndef WITHOUT_XATTR -#if __APPLE__ +#if WITHOUT_XATTR + return (errno=ENOTSUP,-1); +#elif __APPLE__ return ::removexattr(path.c_str(),attrname,XATTR_NOFOLLOW); #else return ::lremovexattr(path.c_str(),attrname); -#endif /* __APPLE__ */ -#else - return (errno=ENOTSUP,-1); #endif } } diff --git a/src/fs_base_setxattr.hpp b/src/fs_base_setxattr.hpp index bc9a3b82..1ce65f2d 100644 --- a/src/fs_base_setxattr.hpp +++ b/src/fs_base_setxattr.hpp @@ -35,14 +35,12 @@ namespace fs const size_t size, const int flags) { -#ifndef WITHOUT_XATTR -#if __APPLE__ +#if WITHOUT_XATTR + return (errno=ENOTSUP,-1); +#elif __APPLE__ return ::setxattr(path.c_str(),name,value,size,0,flags); #else return ::lsetxattr(path.c_str(),name,value,size,flags); -#endif /* __APPLE__ */ -#else - return (errno=ENOTSUP,-1); #endif } }