From 7e5357a1cf40ebaa7ffaeebfd3a88c3ba93eb1a7 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 3 May 2023 09:29:19 -0400 Subject: style: Don't use tabs to indent preprocessor directives --- src/bfstd.c | 6 ++--- src/bfstd.h | 32 +++++++++++------------ src/config.h | 84 ++++++++++++++++++++++++++++++------------------------------ src/dir.c | 20 +++++++-------- src/eval.c | 22 ++++++++-------- src/fsade.c | 8 +++--- src/fsade.h | 8 +++--- src/mtab.c | 20 +++++++-------- src/printf.c | 8 +++--- src/stat.c | 10 ++++---- src/stat.h | 8 +++--- src/trie.c | 30 +++++++++++----------- src/xregex.c | 28 ++++++++++---------- src/xspawn.c | 2 +- 14 files changed, 143 insertions(+), 143 deletions(-) diff --git a/src/bfstd.c b/src/bfstd.c index bc31288..1dc322b 100644 --- a/src/bfstd.c +++ b/src/bfstd.c @@ -19,13 +19,13 @@ #include #if BFS_USE_SYS_SYSMACROS_H -# include +# include #elif BFS_USE_SYS_MKDEV_H -# include +# include #endif #if BFS_USE_UTIL_H -# include +# include #endif bool is_nonexistence_error(int error) { diff --git a/src/bfstd.h b/src/bfstd.h index f85b74f..028e4e6 100644 --- a/src/bfstd.h +++ b/src/bfstd.h @@ -21,29 +21,29 @@ bool is_nonexistence_error(int error); #include #ifndef O_EXEC -# ifdef O_PATH -# define O_EXEC O_PATH -# else -# define O_EXEC O_RDONLY -# endif +# ifdef O_PATH +# define O_EXEC O_PATH +# else +# define O_EXEC O_RDONLY +# endif #endif #ifndef O_SEARCH -# ifdef O_PATH -# define O_SEARCH O_PATH -# else -# define O_SEARCH O_RDONLY -# endif +# ifdef O_PATH +# define O_SEARCH O_PATH +# else +# define O_SEARCH O_RDONLY +# endif #endif #ifndef O_DIRECTORY -# define O_DIRECTORY 0 +# define O_DIRECTORY 0 #endif #include #if !defined(FNM_CASEFOLD) && defined(FNM_IGNORECASE) -# define FNM_CASEFOLD FNM_IGNORECASE +# define FNM_CASEFOLD FNM_IGNORECASE #endif // #include @@ -144,10 +144,10 @@ int xminor(dev_t dev); // #include #if __APPLE__ -# define st_atim st_atimespec -# define st_ctim st_ctimespec -# define st_mtim st_mtimespec -# define st_birthtim st_birthtimespec +# define st_atim st_atimespec +# define st_ctim st_ctimespec +# define st_mtim st_mtimespec +# define st_birthtim st_birthtimespec #endif // #include diff --git a/src/config.h b/src/config.h index 34ae11d..5f54250 100644 --- a/src/config.h +++ b/src/config.h @@ -14,13 +14,13 @@ // bfs packaging configuration #ifndef BFS_COMMAND -# define BFS_COMMAND "bfs" +# define BFS_COMMAND "bfs" #endif #ifndef BFS_VERSION -# define BFS_VERSION "2.6.3" +# define BFS_VERSION "2.6.3" #endif #ifndef BFS_HOMEPAGE -# define BFS_HOMEPAGE "https://tavianator.com/projects/bfs.html" +# define BFS_HOMEPAGE "https://tavianator.com/projects/bfs.html" #endif // Check for system headers @@ -28,34 +28,34 @@ #ifdef __has_include #if __has_include() -# define BFS_HAS_MNTENT_H true +# define BFS_HAS_MNTENT_H true #endif #if __has_include() -# define BFS_HAS_PATHS_H true +# define BFS_HAS_PATHS_H true #endif #if __has_include() -# define BFS_HAS_SYS_ACL_H true +# define BFS_HAS_SYS_ACL_H true #endif #if __has_include() -# define BFS_HAS_SYS_CAPABILITY_H true +# define BFS_HAS_SYS_CAPABILITY_H true #endif #if __has_include() -# define BFS_HAS_SYS_EXTATTR_H true +# define BFS_HAS_SYS_EXTATTR_H true #endif #if __has_include() -# define BFS_HAS_SYS_MKDEV_H true +# define BFS_HAS_SYS_MKDEV_H true #endif #if __has_include() -# define BFS_HAS_SYS_PARAM_H true +# define BFS_HAS_SYS_PARAM_H true #endif #if __has_include() -# define BFS_HAS_SYS_SYSMACROS_H true +# define BFS_HAS_SYS_SYSMACROS_H true #endif #if __has_include() -# define BFS_HAS_SYS_XATTR_H true +# define BFS_HAS_SYS_XATTR_H true #endif #if __has_include() -# define BFS_HAS_UTIL_H true +# define BFS_HAS_UTIL_H true #endif #else // !__has_include @@ -74,59 +74,59 @@ #endif // !__has_include #ifndef BFS_USE_MNTENT_H -# define BFS_USE_MNTENT_H BFS_HAS_MNTENT_H +# define BFS_USE_MNTENT_H BFS_HAS_MNTENT_H #endif #ifndef BFS_USE_PATHS_H -# define BFS_USE_PATHS_H BFS_HAS_PATHS_H +# define BFS_USE_PATHS_H BFS_HAS_PATHS_H #endif #ifndef BFS_USE_SYS_ACL_H -# define BFS_USE_SYS_ACL_H BFS_HAS_SYS_ACL_H +# define BFS_USE_SYS_ACL_H BFS_HAS_SYS_ACL_H #endif #ifndef BFS_USE_SYS_CAPABILITY_H -# define BFS_USE_SYS_CAPABILITY_H BFS_HAS_SYS_CAPABILITY_H +# define BFS_USE_SYS_CAPABILITY_H BFS_HAS_SYS_CAPABILITY_H #endif #ifndef BFS_USE_SYS_EXTATTR_H -# define BFS_USE_SYS_EXTATTR_H BFS_HAS_SYS_EXTATTR_H +# define BFS_USE_SYS_EXTATTR_H BFS_HAS_SYS_EXTATTR_H #endif #ifndef BFS_USE_SYS_MKDEV_H -# define BFS_USE_SYS_MKDEV_H BFS_HAS_SYS_MKDEV_H +# define BFS_USE_SYS_MKDEV_H BFS_HAS_SYS_MKDEV_H #endif #ifndef BFS_USE_SYS_PARAM_H -# define BFS_USE_SYS_PARAM_H BFS_HAS_SYS_PARAM_H +# define BFS_USE_SYS_PARAM_H BFS_HAS_SYS_PARAM_H #endif #ifndef BFS_USE_SYS_SYSMACROS_H -# define BFS_USE_SYS_SYSMACROS_H BFS_HAS_SYS_SYSMACROS_H +# define BFS_USE_SYS_SYSMACROS_H BFS_HAS_SYS_SYSMACROS_H #endif #ifndef BFS_USE_SYS_XATTR_H -# define BFS_USE_SYS_XATTR_H BFS_HAS_SYS_XATTR_H +# define BFS_USE_SYS_XATTR_H BFS_HAS_SYS_XATTR_H #endif #ifndef BFS_USE_UTIL_H -# define BFS_USE_UTIL_H BFS_HAS_UTIL_H +# define BFS_USE_UTIL_H BFS_HAS_UTIL_H #endif // Stub out feature detection on old/incompatible compilers #ifndef __has_feature -# define __has_feature(feat) false +# define __has_feature(feat) false #endif #ifndef __has_c_attribute -# define __has_c_attribute(attr) false +# define __has_c_attribute(attr) false #endif #ifndef __has_attribute -# define __has_attribute(attr) false +# define __has_attribute(attr) false #endif // Platform detection // Get the definition of BSD if available #if BFS_USE_SYS_PARAM_H -# include +# include #endif #ifndef __GLIBC_PREREQ -# define __GLIBC_PREREQ(maj, min) false +# define __GLIBC_PREREQ(maj, min) false #endif // Wrappers for fundamental language features/extensions @@ -135,11 +135,11 @@ * Silence compiler warnings about switch/case fall-throughs. */ #if __has_c_attribute(fallthrough) -# define BFS_FALLTHROUGH [[fallthrough]] +# define BFS_FALLTHROUGH [[fallthrough]] #elif __has_attribute(fallthrough) -# define BFS_FALLTHROUGH __attribute__((fallthrough)) +# define BFS_FALLTHROUGH __attribute__((fallthrough)) #else -# define BFS_FALLTHROUGH ((void)0) +# define BFS_FALLTHROUGH ((void)0) #endif /** @@ -173,40 +173,40 @@ * Adds compiler warnings for bad printf()-style function calls, if supported. */ #if __has_attribute(format) -# define BFS_FORMATTER(fmt, args) __attribute__((format(printf, fmt, args))) +# define BFS_FORMATTER(fmt, args) __attribute__((format(printf, fmt, args))) #else -# define BFS_FORMATTER(fmt, args) +# define BFS_FORMATTER(fmt, args) #endif /** * Check if function multiversioning via GNU indirect functions (ifunc) is supported. */ #if !defined(BFS_TARGET_CLONES) && __has_attribute(target_clones) && (__GLIBC__ || __FreeBSD__ || __NetBSD__) -# define BFS_TARGET_CLONES true +# define BFS_TARGET_CLONES true #endif /** * Ignore a particular GCC warning for a region of code. */ #if __GNUC__ -# define BFS_PRAGMA_STRINGIFY(...) _Pragma(#__VA_ARGS__) -# define BFS_SUPPRESS(warning) \ - _Pragma("GCC diagnostic push"); \ +# define BFS_PRAGMA_STRINGIFY(...) _Pragma(#__VA_ARGS__) +# define BFS_SUPPRESS(warning) \ + _Pragma("GCC diagnostic push"); \ BFS_PRAGMA_STRINGIFY(GCC diagnostic ignored warning) -# define BFS_UNSUPPRESS() \ +# define BFS_UNSUPPRESS() \ _Pragma("GCC diagnostic pop") #else -# define BFS_SUPPRESS(warning) -# define BFS_UNSUPPRESS() +# define BFS_SUPPRESS(warning) +# define BFS_UNSUPPRESS() #endif /** * Initialize a variable, unless sanitizers would detect uninitialized uses. */ #if __has_feature(memory_sanitizer) -# define BFS_UNINIT(var, value) var = var +# define BFS_UNINIT(var, value) var = var #else -# define BFS_UNINIT(var, value) var = value +# define BFS_UNINIT(var, value) var = value #endif #endif // BFS_CONFIG_H diff --git a/src/dir.c b/src/dir.c index 2719c15..eb6e3e0 100644 --- a/src/dir.c +++ b/src/dir.c @@ -16,16 +16,16 @@ #include #ifndef BFS_GETDENTS -# define BFS_GETDENTS (__linux__ || __FreeBSD__) +# define BFS_GETDENTS (__linux__ || __FreeBSD__) #endif #if BFS_GETDENTS -# if __has_feature(memory_sanitizer) -# include -# endif -# if __linux__ -# include -# endif +# if __has_feature(memory_sanitizer) +# include +# endif +# if __linux__ +# include +# endif /** getdents() syscall wrapper. */ static ssize_t bfs_getdents(int fd, void *buf, size_t size) { @@ -119,10 +119,10 @@ struct bfs_dir { }; #if BFS_GETDENTS -# define DIR_SIZE (64 << 10) -# define BUF_SIZE (DIR_SIZE - sizeof(struct bfs_dir)) +# define DIR_SIZE (64 << 10) +# define BUF_SIZE (DIR_SIZE - sizeof(struct bfs_dir)) #else -# define DIR_SIZE sizeof(struct bfs_dir) +# define DIR_SIZE sizeof(struct bfs_dir) #endif struct bfs_dir *bfs_opendir(int at_fd, const char *at_path) { diff --git a/src/eval.c b/src/eval.c index 53ce605..687ba32 100644 --- a/src/eval.c +++ b/src/eval.c @@ -943,9 +943,9 @@ bool eval_xtype(const struct bfs_expr *expr, struct bfs_eval *state) { } #if _POSIX_MONOTONIC_CLOCK > 0 -# define BFS_CLOCK CLOCK_MONOTONIC +# define BFS_CLOCK CLOCK_MONOTONIC #elif _POSIX_TIMERS > 0 -# define BFS_CLOCK CLOCK_REALTIME +# define BFS_CLOCK CLOCK_REALTIME #endif /** @@ -1194,15 +1194,15 @@ static bool eval_file_unique(struct bfs_eval *state, struct trie *seen) { } } -#define DEBUG_FLAG(flags, flag) \ - do { \ - if ((flags & flag) || flags == flag) { \ - fputs(#flag, stderr); \ - flags ^= flag; \ - if (flags) { \ - fputs(" | ", stderr); \ - } \ - } \ +#define DEBUG_FLAG(flags, flag) \ + do { \ + if ((flags & flag) || flags == flag) { \ + fputs(#flag, stderr); \ + flags ^= flag; \ + if (flags) { \ + fputs(" | ", stderr); \ + } \ + } \ } while (0) /** diff --git a/src/fsade.c b/src/fsade.c index a61a6b8..aefbb75 100644 --- a/src/fsade.c +++ b/src/fsade.c @@ -13,17 +13,17 @@ #include #if BFS_CAN_CHECK_ACL -# include +# include #endif #if BFS_CAN_CHECK_CAPABILITIES -# include +# include #endif #if BFS_USE_SYS_EXTATTR_H -# include +# include #elif BFS_USE_SYS_XATTR_H -# include +# include #endif #if BFS_CAN_CHECK_ACL || BFS_CAN_CHECK_CAPABILITIES || BFS_CAN_CHECK_XATTRS diff --git a/src/fsade.h b/src/fsade.h index 9bef892..557da26 100644 --- a/src/fsade.h +++ b/src/fsade.h @@ -15,10 +15,10 @@ #define BFS_CAN_CHECK_ACL BFS_USE_SYS_ACL_H #if !defined(BFS_CAN_CHECK_CAPABILITIES) && BFS_USE_SYS_CAPABILITY_H && !__FreeBSD__ -# include -# ifdef CAP_CHOWN -# define BFS_CAN_CHECK_CAPABILITIES true -# endif +# include +# ifdef CAP_CHOWN +# define BFS_CAN_CHECK_CAPABILITIES true +# endif #endif #define BFS_CAN_CHECK_XATTRS (BFS_USE_SYS_EXTATTR_H || BFS_USE_SYS_XATTR_H) diff --git a/src/mtab.c b/src/mtab.c index 0e377a1..27f1743 100644 --- a/src/mtab.c +++ b/src/mtab.c @@ -15,23 +15,23 @@ #include #if BFS_USE_MNTENT_H -# define BFS_MNTENT 1 +# define BFS_MNTENT 1 #elif BSD -# define BFS_MNTINFO 1 +# define BFS_MNTINFO 1 #elif __SVR4 -# define BFS_MNTTAB 1 +# define BFS_MNTTAB 1 #endif #if BFS_MNTENT -# include -# include -# include +# include +# include +# include #elif BFS_MNTINFO -# include -# include +# include +# include #elif BFS_MNTTAB -# include -# include +# include +# include #endif /** diff --git a/src/printf.c b/src/printf.c index 1b4f2d4..726d54d 100644 --- a/src/printf.c +++ b/src/printf.c @@ -72,10 +72,10 @@ static bool should_color(CFILE *cfile, const struct bfs_printf *directive) { /** * Print a value to a temporary buffer before formatting it. */ -#define BFS_PRINTF_BUF(buf, format, ...) \ - char buf[256]; \ - int ret = snprintf(buf, sizeof(buf), format, __VA_ARGS__); \ - assert(ret >= 0 && (size_t)ret < sizeof(buf)); \ +#define BFS_PRINTF_BUF(buf, format, ...) \ + char buf[256]; \ + int ret = snprintf(buf, sizeof(buf), format, __VA_ARGS__); \ + assert(ret >= 0 && (size_t)ret < sizeof(buf)); \ (void)ret /** diff --git a/src/stat.c b/src/stat.c index aaa5eac..f3d9046 100644 --- a/src/stat.c +++ b/src/stat.c @@ -13,15 +13,15 @@ #include #if defined(STATX_BASIC_STATS) && (!__ANDROID__ || __ANDROID_API__ >= 30) -# define BFS_LIBC_STATX true +# define BFS_LIBC_STATX true #elif __linux__ -# include -# include -# include +# include +# include +# include #endif #if BFS_LIBC_STATX || defined(__NR_statx) -# define BFS_STATX true +# define BFS_STATX true #endif const char *bfs_stat_field_name(enum bfs_stat_field field) { diff --git a/src/stat.h b/src/stat.h index 7a70146..e08dd4d 100644 --- a/src/stat.h +++ b/src/stat.h @@ -17,7 +17,7 @@ #include #if BFS_USE_SYS_PARAM_H -# include +# include #endif /** @@ -61,11 +61,11 @@ enum bfs_stat_flags { }; #ifdef DEV_BSIZE -# define BFS_STAT_BLKSIZE DEV_BSIZE +# define BFS_STAT_BLKSIZE DEV_BSIZE #elif defined(S_BLKSIZE) -# define BFS_STAT_BLKSIZE S_BLKSIZE +# define BFS_STAT_BLKSIZE S_BLKSIZE #else -# define BFS_STAT_BLKSIZE 512 +# define BFS_STAT_BLKSIZE 512 #endif /** diff --git a/src/trie.c b/src/trie.c index 43df9dc..9f2e45f 100644 --- a/src/trie.c +++ b/src/trie.c @@ -94,9 +94,9 @@ static_assert(CHAR_BIT == 8, "This trie implementation assumes 8-bit bytes."); #if BFS_TARGET_CLONES && (__i386__ || __x86_64__) -# define TARGET_CLONES_POPCNT __attribute__((target_clones("popcnt", "default"))) +# define TARGET_CLONES_POPCNT __attribute__((target_clones("popcnt", "default"))) #else -# define TARGET_CLONES_POPCNT +# define TARGET_CLONES_POPCNT #endif /** Number of bits for the sparse array bitmap, aka the range of a nibble. */ @@ -367,23 +367,23 @@ static size_t trie_node_size(unsigned int size) { } #if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -# define TRIE_BSWAP(n) (n) +# define TRIE_BSWAP(n) (n) #elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ -# if __SIZEOF_SIZE_T__ == 8 -# define TRIE_BSWAP(n) __builtin_bswap64(n) -# elif __SIZEOF_SIZE_T__ == 4 -# define TRIE_BSWAP(n) __builtin_bswap32(n) -# endif +# if __SIZEOF_SIZE_T__ == 8 +# define TRIE_BSWAP(n) __builtin_bswap64(n) +# elif __SIZEOF_SIZE_T__ == 4 +# define TRIE_BSWAP(n) __builtin_bswap32(n) +# endif #endif #ifdef TRIE_BSWAP -# if __SIZEOF_SIZE_T__ == __SIZEOF_LONG_LONG__ -# define TRIE_CTZ(n) __builtin_ctzll(n) -# elif __SIZEOF_SIZE_T__ == __SIZEOF_LONG__ -# define TRIE_CTZ(n) __builtin_ctzl(n) -# elif __SIZEOF_SIZE_T__ == __SIZEOF_INT__ -# define TRIE_CTZ(n) __builtin_ctz(n) -# endif +# if __SIZEOF_SIZE_T__ == __SIZEOF_LONG_LONG__ +# define TRIE_CTZ(n) __builtin_ctzll(n) +# elif __SIZEOF_SIZE_T__ == __SIZEOF_LONG__ +# define TRIE_CTZ(n) __builtin_ctzl(n) +# elif __SIZEOF_SIZE_T__ == __SIZEOF_INT__ +# define TRIE_CTZ(n) __builtin_ctz(n) +# endif #endif /** Find the offset of the first nibble that differs between two keys. */ diff --git a/src/xregex.c b/src/xregex.c index 5f5480f..a7153b7 100644 --- a/src/xregex.c +++ b/src/xregex.c @@ -9,10 +9,10 @@ #include #if BFS_WITH_ONIGURUMA -# include -# include +# include +# include #else -# include +# include #endif struct bfs_regex { @@ -43,20 +43,20 @@ static int bfs_onig_encoding(OnigEncoding *penc) { // from the current locale. const char *charmap = nl_langinfo(CODESET); if (charmap) { -#define BFS_MAP_ENCODING(name, value) \ - do { \ - if (strcmp(charmap, name) == 0) { \ - enc = value; \ - } \ +#define BFS_MAP_ENCODING(name, value) \ + do { \ + if (strcmp(charmap, name) == 0) { \ + enc = value; \ + } \ } while (0) -#define BFS_MAP_ENCODING2(name1, name2, value) \ - do { \ - BFS_MAP_ENCODING(name1, value); \ - BFS_MAP_ENCODING(name2, value); \ +#define BFS_MAP_ENCODING2(name1, name2, value) \ + do { \ + BFS_MAP_ENCODING(name1, value); \ + BFS_MAP_ENCODING(name2, value); \ } while (0) // These names were found with locale -m on Linux and FreeBSD -#define BFS_MAP_ISO_8859(n) \ +#define BFS_MAP_ISO_8859(n) \ BFS_MAP_ENCODING2("ISO-8859-" #n, "ISO8859-" #n, ONIG_ENCODING_ISO_8859_ ## n) BFS_MAP_ISO_8859(1); @@ -78,7 +78,7 @@ static int bfs_onig_encoding(OnigEncoding *penc) { BFS_MAP_ENCODING("UTF-8", ONIG_ENCODING_UTF8); -#define BFS_MAP_EUC(name) \ +#define BFS_MAP_EUC(name) \ BFS_MAP_ENCODING2("EUC-" #name, "euc" #name, ONIG_ENCODING_EUC_ ## name) BFS_MAP_EUC(JP); diff --git a/src/xspawn.c b/src/xspawn.c index a185200..a6d18a3 100644 --- a/src/xspawn.c +++ b/src/xspawn.c @@ -16,7 +16,7 @@ #include #if BFS_USE_PATHS_H -# include +# include #endif /** -- cgit v1.2.3