diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-01-19 02:23:18 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-01-19 02:23:18 +0000 |
commit | ea6eb383294fbf1def7d05e4785a78e68cbf31ce (patch) | |
tree | 8475572d9574bc074ebc2d46b1aa48def4312487 /posix | |
parent | b51094bd752d9c1c01ec46b54ab10c0c0e5d729d (diff) | |
download | glibc-ea6eb383294fbf1def7d05e4785a78e68cbf31ce.zip glibc-ea6eb383294fbf1def7d05e4785a78e68cbf31ce.tar.gz glibc-ea6eb383294fbf1def7d05e4785a78e68cbf31ce.tar.bz2 |
Update.
2000-01-18 Bruno Haible <haible@ilog.fr>
* posix/fnmatch.c (ISWCTYPE): New macro.
(__wcschrnul): New function.
(BTOWC): New macro. Define it instead of __btowc.
(is_char_class) [!_LIBC]: Fix 'mstate_t' typo. Fix 2nd arg to
wcsrtombs. Call wctype, not __wctype.
* posix/fnmatch_loop.c (FCT): Use ISWCTYPE instead of __iswctype, and
BTOWC instead of __btowc.
2000-01-18 Andreas Jaeger <aj@suse.de>
* inet/Versions: Add new functions added on 2000-01-17.
Diffstat (limited to 'posix')
-rw-r--r-- | posix/fnmatch.c | 37 | ||||
-rw-r--r-- | posix/fnmatch_loop.c | 5 |
2 files changed, 35 insertions, 7 deletions
diff --git a/posix/fnmatch.c b/posix/fnmatch.c index 2dbebfe..85a50ef 100644 --- a/posix/fnmatch.c +++ b/posix/fnmatch.c @@ -106,6 +106,12 @@ # define IS_CHAR_CLASS(string) wctype (string) # endif +# ifdef _LIBC +# define ISWCTYPE(WC, WT) __iswctype (WC, WT) +# else +# define ISWCTYPE(WC, WT) iswctype (WC, WT) +# endif + # if (HAVE_MBSTATE_T && HAVE_MBSRTOWCS) || _LIBC /* In this case we are implementing the multibyte character handling. */ # define HANDLE_MULTIBYTE 1 @@ -149,6 +155,19 @@ __strchrnul (s, c) } # endif +# if HANDLE_MULTIBYTE && !defined HAVE___STRCHRNUL && !defined _LIBC +static wchar_t * +__wcschrnul (s, c) + const wchar_t *s; + wint_t c; +{ + wchar_t *result = wcschr (s, c); + if (result == NULL) + result = wcschr (s, '\0'); + return result; +} +# endif + # ifndef internal_function /* Inside GNU libc we mark some function in a special way. In other environments simply ignore the marking. */ @@ -165,6 +184,11 @@ __strchrnul (s, c) # define UCHAR unsigned char # define FCT internal_fnmatch # define L(CS) CS +# ifdef _LIBC +# define BTOWC(C) __btowc (C) +# else +# define BTOWC(C) btowc (C) +# endif # define STRCHR(S, C) strchr (S, C) # define STRCHRNUL(S, C) __strchrnul (S, C) # include "fnmatch_loop.c" @@ -181,7 +205,7 @@ __strchrnul (s, c) # define UCHAR wint_t # define FCT internal_fnwmatch # define L(CS) L##CS -# define __btowc(wc) wc +# define BTOWC(C) (C) # define STRCHR(S, C) wcschr (S, C) # define STRCHRNUL(S, C) __wcschrnul (S, C) @@ -214,22 +238,25 @@ is_char_class (const wchar_t *wcs) static wctype_t is_char_class (const wchar_t *wcs) { - mstate_t ps; + mbstate_t ps; + const wchar_t *pwc; char *s; size_t n; memset (&ps, '\0', sizeof (ps)); - n = wcsrtombs (NULL, wcs, 0, &ps); + pwc = wcs; + n = wcsrtombs (NULL, &pwc, 0, &ps); if (n == (size_t) -1) /* Something went wrong. */ return 0; s = alloca (n + 1); assert (mbsinit (&ps)); - (void) wcsrtombs (s, wcs, n + 1, &ps); + pwc = wcs; + (void) wcsrtombs (s, &pwc, n + 1, &ps); - return __wctype (s); + return wctype (s); } # endif # define IS_CHAR_CLASS(string) is_char_class (string) diff --git a/posix/fnmatch_loop.c b/posix/fnmatch_loop.c index 037a26d..a7fcac7 100644 --- a/posix/fnmatch_loop.c +++ b/posix/fnmatch_loop.c @@ -224,7 +224,7 @@ FCT (pattern, string, no_leading_period, flags) /* Invalid character class name. */ return FNM_NOMATCH; - if (__iswctype (__btowc ((UCHAR) *n), wt)) + if (ISWCTYPE (BTOWC ((UCHAR) *n), wt)) goto matched; # else if ((STREQ (str, L("alnum")) && ISALNUM ((UCHAR) *n)) @@ -325,6 +325,7 @@ FCT (pattern, string, no_leading_period, flags) return 0; return FNM_NOMATCH; +} #undef FOLD #undef CHAR @@ -333,4 +334,4 @@ FCT (pattern, string, no_leading_period, flags) #undef STRCHR #undef STRCHRNUL #undef L -} +#undef BTOWC |