From 6ab33938d5239e8688440f65e802f627622d301b Mon Sep 17 00:00:00 2001 From: James Peach Date: Mon, 24 Apr 2006 00:16:51 +0000 Subject: r15186: Introduce ISDOT and ISDOTDOT macros for testing whether a filename is "." for "..". These express the intention better that strcmp or strequal and improve searchability via cscope/ctags. (This used to be commit 7e4ad7e8e5ec266b969e3075c4ad7f021571f24e) --- source4/include/system/dir.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'source4/include/system') diff --git a/source4/include/system/dir.h b/source4/include/system/dir.h index 07a732e206..ce6aae0264 100644 --- a/source4/include/system/dir.h +++ b/source4/include/system/dir.h @@ -40,3 +40,22 @@ #ifndef HAVE_MKDIR_MODE #define mkdir(dir, mode) mkdir(dir) #endif + +/* Test whether a file name is the "." or ".." directory entries. + * These really should be inline functions. + */ +#ifndef ISDOT +#define ISDOT(path) ( \ + *((const char *)path) == '.' && \ + *(((const char *)path) + 1) == '\0' \ + ) +#endif + +#ifndef ISDOTDOT +#define ISDOTDOT(path) ( \ + *((const char *)path) == '.' && \ + *(((const char *)path) + 1) == '.' && \ + *(((const char *)path) + 2) == '\0' \ + ) +#endif + -- cgit