(WIDE_CHAR_SUPPORT): New macro. Use it uniformly instead of
authorJim Meyering <jim@meyering.net>
Wed, 26 Jun 2002 06:17:35 +0000 (06:17 +0000)
committerJim Meyering <jim@meyering.net>
Wed, 26 Jun 2002 06:17:35 +0000 (06:17 +0000)
(defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H).
It also uses HAVE_BTOWC, to fix a porting bug on Solaris 2.5.1
reported by Vin Shelton.

lib/fnmatch.c
lib/fnmatch_loop.c

index 452edc0..73dc0e7 100644 (file)
@@ -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>
@@ -103,7 +105,6 @@ extern int fnmatch (const char *pattern, const char *string, int flags);
 #if defined _LIBC || !defined __GNU_LIBRARY__ || !HAVE_FNMATCH_GNU
 
 
-# undef ISASCII  /* defined in Solaris5.6's /usr/include/sys/euc.h */
 # if defined STDC_HEADERS || !defined isascii
 #  define ISASCII(c) 1
 # else
@@ -121,7 +122,6 @@ extern int fnmatch (const char *pattern, const char *string, int flags);
 #  define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c))
 # endif
 
-# undef ISPRINT  /* defined in Solaris5.6's /usr/include/sys/euc.h */
 # define ISPRINT(c) (ISASCII (c) && isprint (c))
 # define ISDIGIT(c) (ISASCII (c) && isdigit (c))
 # define ISALNUM(c) (ISASCII (c) && isalnum (c))
@@ -135,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
index e7b0a91..e3450b6 100644 (file)
@@ -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.  */