summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2002-06-12 06:06:47 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2002-06-12 06:06:47 +0000
commitedd7dd52ff64c0bbb05198a7fb6cc8cd9b164ad4 (patch)
treef1696e51c69574e317853fe8bb42b4f94aa3c99b /lib
parent4b89533a437ec6309014174b534c28a9178a2777 (diff)
downloaddiffutils-edd7dd52ff64c0bbb05198a7fb6cc8cd9b164ad4.tar.gz
(WIDE_CHAR_SUPPORT): New macro. Use it uniformly instead of
(defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H). It also depends on HAVE_BTOWC.
Diffstat (limited to 'lib')
-rw-r--r--lib/fnmatch.c6
-rw-r--r--lib/fnmatch_loop.c4
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/fnmatch.c b/lib/fnmatch.c
index d6ba6cb..15ea88d 100644
--- a/lib/fnmatch.c
+++ b/lib/fnmatch.c
@@ -63,9 +63,11 @@ char *alloca ();
# include <stdlib.h>
#endif
+#define WIDE_CHAR_SUPPORT (HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC)
+
/* For platform which support the ISO C amendement 1 functionality we
support user defined character classes. */
-#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
+#if defined _LIBC || WIDE_CHAR_SUPPORT
/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
# include <wchar.h>
# include <wctype.h>
@@ -133,7 +135,7 @@ extern int fnmatch (const char *pattern, const char *string, int flags);
# define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
-# if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
+# if defined _LIBC || WIDE_CHAR_SUPPORT
/* The GNU C library provides support for user-defined character classes
and the functions from ISO C amendement 1. */
# ifdef CHARCLASS_NAME_MAX
diff --git a/lib/fnmatch_loop.c b/lib/fnmatch_loop.c
index 3211774..acecd23 100644
--- a/lib/fnmatch_loop.c
+++ b/lib/fnmatch_loop.c
@@ -248,7 +248,7 @@ FCT (pattern, string, string_end, no_leading_period, flags)
/* Leave room for the null. */
CHAR str[CHAR_CLASS_MAX_LENGTH + 1];
size_t c1 = 0;
-#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
+#if defined _LIBC || WIDE_CHAR_SUPPORT
wctype_t wt;
#endif
const CHAR *startp = p;
@@ -278,7 +278,7 @@ FCT (pattern, string, string_end, no_leading_period, flags)
}
str[c1] = L('\0');
-#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
+#if defined _LIBC || WIDE_CHAR_SUPPORT
wt = IS_CHAR_CLASS (str);
if (wt == 0)
/* Invalid character class name. */