diff options
Diffstat (limited to 'wctype/iswctype.c')
-rw-r--r-- | wctype/iswctype.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/wctype/iswctype.c b/wctype/iswctype.c index 58a2a5288f..60475d0192 100644 --- a/wctype/iswctype.c +++ b/wctype/iswctype.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996 Free Software Foundation, Inc. +/* Copyright (C) 1996, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>. @@ -21,6 +21,7 @@ #include <wctype.h> #include "cname-lookup.h" +#include "wchar-lookup.h" extern unsigned int *__ctype32_b; @@ -29,12 +30,26 @@ extern unsigned int *__ctype32_b; int __iswctype (wint_t wc, wctype_t desc) { - size_t idx; - - idx = cname_lookup (wc); - if (idx == ~((size_t) 0)) - return 0; - - return __ctype32_b[idx] & desc; + if (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_HASH_SIZE) != 0) + { + /* Old locale format. */ + size_t idx; + + idx = cname_lookup (wc); + if (idx == ~((size_t) 0)) + return 0; + + return __ctype32_b[idx] & desc; + } + else + { + /* If the user passes in an invalid DESC valid (the one returned from + `wctype' in case of an error) simply return 0. */ + if (desc == (wctype_t) 0) + return 0; + + /* New locale format. */ + return wctype_table_lookup ((const char *) desc, wc); + } } weak_alias (__iswctype, iswctype) |