summaryrefslogtreecommitdiff
path: root/make.h
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2010-07-01 05:59:08 +0000
committerPaul Smith <psmith@gnu.org>2010-07-01 05:59:08 +0000
commit7746a1f74fa7696452a3c25953c7fb9a5feb5a6c (patch)
treeae8f49e2d9fdcf9ab99c9640890231c9e4c51ce5 /make.h
parentc0239cdbfa81e40087cc1d93bcf292eee2a3fc68 (diff)
downloadgunmake-7746a1f74fa7696452a3c25953c7fb9a5feb5a6c.tar.gz
- Rename strieq() to patheq() for clarity.
- Convert xmalloc/memset pairs to xcalloc.
Diffstat (limited to 'make.h')
-rw-r--r--make.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/make.h b/make.h
index 2841c7f..65faadc 100644
--- a/make.h
+++ b/make.h
@@ -264,23 +264,23 @@ char *strsignal (int signum);
host does not conform to POSIX. */
#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
-#ifndef iAPX286
-# define streq(a, b) \
+/* Test if two strings are equal. Is this worthwhile? Should be profiled. */
+#define streq(a, b) \
((a) == (b) || \
(*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1))))
-# ifdef HAVE_CASE_INSENSITIVE_FS
-# define strieq(a, b) \
+
+/* Test if two strings are equal, but match case-insensitively on systems
+ which have case-insensitive filesystems. Should only be used for
+ filenames! */
+#ifdef HAVE_CASE_INSENSITIVE_FS
+# define patheq(a, b) \
((a) == (b) \
|| (tolower((unsigned char)*(a)) == tolower((unsigned char)*(b)) \
&& (*(a) == '\0' || !strcasecmp ((a) + 1, (b) + 1))))
-# else
-# define strieq(a, b) streq(a, b)
-# endif
#else
-/* Buggy compiler can't handle this. */
-# define streq(a, b) (strcmp ((a), (b)) == 0)
-# define strieq(a, b) (strcmp ((a), (b)) == 0)
+# define patheq(a, b) streq(a, b)
#endif
+
#define strneq(a, b, l) (strncmp ((a), (b), (l)) == 0)
#if defined(__GNUC__) || defined(ENUM_BITFIELDS)