summaryrefslogtreecommitdiff
path: root/src/system.h
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2006-08-27 19:34:28 +0000
committerJim Meyering <jim@meyering.net>2006-08-27 19:34:28 +0000
commit07446625096ddeb9246fb36572d5fe644f56cd1f (patch)
tree607b82beccc330d0af2703c4e204218afea74d64 /src/system.h
parent0a94897cfea53424289dc32ddb8efa9728561003 (diff)
downloadcoreutils-07446625096ddeb9246fb36572d5fe644f56cd1f.tar.xz
* src/system.h (DOT_OR_DOTDOT): Remove macro. Rewrite as a...
(dot_or_dotdot): ...new static inline function. * src/remove.c (rm_1): Reflect this renaming. * src/ls.c (basename_is_dot_or_dotdot): Likewise.
Diffstat (limited to 'src/system.h')
-rw-r--r--src/system.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/system.h b/src/system.h
index 29bd1be55..226c863c9 100644
--- a/src/system.h
+++ b/src/system.h
@@ -447,9 +447,14 @@ uid_t getuid ();
#include "unlocked-io.h"
#include "same-inode.h"
-#define DOT_OR_DOTDOT(Basename) \
- (Basename[0] == '.' && (Basename[1] == '\0' \
- || (Basename[1] == '.' && Basename[2] == '\0')))
+static inline bool
+dot_or_dotdot (char const *file_name)
+{
+ return (file_name[0] == '.'
+ && (file_name[1] == '\0'
+ || (file_name[1] == '.'
+ && file_name[2] == '\0')));
+}
/* A wrapper for readdir so that callers don't see entries for `.' or `..'. */
static inline struct dirent const *
@@ -458,7 +463,7 @@ readdir_ignoring_dot_and_dotdot (DIR *dirp)
while (1)
{
struct dirent const *dp = readdir (dirp);
- if (dp == NULL || ! DOT_OR_DOTDOT (dp->d_name))
+ if (dp == NULL || ! dot_or_dotdot (dp->d_name))
return dp;
}
}