From e3cb529472258dce535b4503934d6141c6562b85 Mon Sep 17 00:00:00 2001 From: Will Andrews Date: Sun, 21 Jan 2001 08:24:41 +0000 Subject: Fix style(9) bug; use ISDOT[DOT,]() macro available in util.c by moving it to make.h so both dir.c and util.c can use it, although bde didn't particularly like this part of the idea, IMO it's cleaner than it was. Submitted by: bde --- usr.bin/make/dir.c | 15 +++++++-------- usr.bin/make/make.h | 2 ++ usr.bin/make/util.c | 3 --- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/usr.bin/make/dir.c b/usr.bin/make/dir.c index f92073186c9ce..0c16cc8f2268f 100644 --- a/usr.bin/make/dir.c +++ b/usr.bin/make/dir.c @@ -1067,15 +1067,14 @@ Dir_AddDir (path, name) } #endif /* sun && d_ino */ - /* Skip the '.' and '..' entries by checking for them specifically - * instead of assuming readdir() reuturns them in that order when - * first going through a directory. This is needed for XFS over - * NFS filesystems since SGI does not guarantee that these are the - * first two entries returned from readdir(). + /* Skip the '.' and '..' entries by checking for them + * specifically instead of assuming readdir() reuturns them in + * that order when first going through a directory. This is + * needed for XFS over NFS filesystems since SGI does not + * guarantee that these are * the first two entries returned + * from readdir(). */ - if (dp->d_name[0] == '.' && - (dp->d_name[1] == NULL || - (dp->d_name[1] == '.' && dp->d_name[2] == NULL))) + if (ISDOT(dp->d_name) || ISDOTDOT(dp->d_name)) continue; (void)Hash_CreateEntry(&p->files, dp->d_name, (Boolean *)NULL); diff --git a/usr.bin/make/make.h b/usr.bin/make/make.h index 003663b9f1334..81aabcb865fc3 100644 --- a/usr.bin/make/make.h +++ b/usr.bin/make/make.h @@ -365,6 +365,8 @@ extern int debug; #endif /* __STDC__ */ #define DEBUG(module) (debug & CONCAT(DEBUG_,module)) +#define ISDOT(c) ((c)[0] == '.' && (((c)[1] == '\0') || ((c)[1] == '/'))) +#define ISDOTDOT(c) ((c)[0] == '.' && ISDOT(&((c)[1]))) /* * Since there are so many, all functions that return non-integer values are diff --git a/usr.bin/make/util.c b/usr.bin/make/util.c index 80197b9ba8fdc..67054c245e8f2 100644 --- a/usr.bin/make/util.c +++ b/usr.bin/make/util.c @@ -155,9 +155,6 @@ signal(s, a)) () #ifndef DEV_DEV_COMPARE # define DEV_DEV_COMPARE(a, b) ((a) == (b)) #endif -#define ISDOT(c) ((c)[0] == '.' && (((c)[1] == '\0') || ((c)[1] == '/'))) -#define ISDOTDOT(c) ((c)[0] == '.' && ISDOT(&((c)[1]))) - /* strrcpy(): * Like strcpy, going backwards and returning the new pointer -- cgit v1.3