about summary refs log tree commit diff
path: root/wctype
diff options
context:
space:
mode:
Diffstat (limited to 'wctype')
-rw-r--r--wctype/wcfuncs.c28
-rw-r--r--wctype/wctype.h76
2 files changed, 15 insertions, 89 deletions
diff --git a/wctype/wcfuncs.c b/wctype/wcfuncs.c
index 2595f50da7..a3aed3104e 100644
--- a/wctype/wcfuncs.c
+++ b/wctype/wcfuncs.c
@@ -21,19 +21,17 @@
 
 #include "wchar-lookup.h"
 
-/* These are not exported.  */
-extern const char *__ctype32_wctype[12] attribute_hidden;
-extern const char *__ctype32_wctrans[2] attribute_hidden;
-
 /* Provide real-function versions of all the wctype macros.  */
 
-#define	func(name, type)					\
-  extern int __##name (wint_t __wc);				\
-  int								\
-  __##name (wint_t wc)						\
-  {								\
-    return wctype_table_lookup (__ctype32_wctype[type], wc);	\
-  }								\
+#define	func(name, type)						      \
+  extern int __##name (wint_t __wc);					      \
+  int									      \
+  __##name (wint_t wc)							      \
+  {									      \
+    size_t i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_CLASS_OFFSET) + type;    \
+    const char *desc = _NL_CURRENT (LC_CTYPE, i);			      \
+    return wctype_table_lookup (desc, wc);				      \
+  }									      \
   weak_alias (__##name, name)
 
 #undef iswalnum
@@ -71,7 +69,9 @@ wint_t
 towlower (wc)
      wint_t wc;
 {
-  return wctrans_table_lookup (__ctype32_wctrans[__TOW_tolower], wc);
+  size_t i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET) + __TOW_tolower;
+  const char *desc = _NL_CURRENT (LC_CTYPE, i);
+  return wctrans_table_lookup (desc, wc);
 }
 libc_hidden_def (towlower)
 
@@ -80,6 +80,8 @@ wint_t
 towupper (wc)
      wint_t wc;
 {
-  return wctrans_table_lookup (__ctype32_wctrans[__TOW_toupper], wc);
+  size_t i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET) + __TOW_toupper;
+  const char *desc = _NL_CURRENT (LC_CTYPE, i);
+  return wctrans_table_lookup (desc, wc);
 }
 libc_hidden_def (towupper)
diff --git a/wctype/wctype.h b/wctype/wctype.h
index 0cd1603c3f..f5519aa4eb 100644
--- a/wctype/wctype.h
+++ b/wctype/wctype.h
@@ -190,64 +190,6 @@ extern wctype_t wctype (__const char *__property) __THROW;
 extern int iswctype (wint_t __wc, wctype_t __desc) __THROW;
 __END_NAMESPACE_C99
 
-#if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus
-/* The tables are always organized in a way which allows direct access
-   for single byte characters.  */
-extern unsigned int *__ctype32_b;
-
-# define iswalnum(wc) \
-  (__extension__							      \
-    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'		      \
-     ? (int) (__ctype32_b[(wint_t) (wc)] & _ISwalnum) : iswalnum (wc)))
-# define iswalpha(wc) \
-  (__extension__							      \
-    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'		      \
-     ? (int) (__ctype32_b[(wint_t) (wc)] & _ISwalpha) : iswalpha (wc)))
-# define iswcntrl(wc) \
-  (__extension__							      \
-    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'		      \
-     ? (int) (__ctype32_b[(wint_t) (wc)] & _ISwcntrl) : iswcntrl (wc)))
-# define iswdigit(wc) \
-  (__extension__							      \
-    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'		      \
-     ? (int) (__ctype32_b[(wint_t) (wc)] & _ISwdigit) : iswdigit (wc)))
-# define iswlower(wc) \
-  (__extension__							      \
-    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'		      \
-     ? (int) (__ctype32_b[(wint_t) (wc)] & _ISwlower) : iswlower (wc)))
-# define iswgraph(wc) \
-  (__extension__							      \
-    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'		      \
-     ? (int) (__ctype32_b[(wint_t) (wc)] & _ISwgraph) : iswgraph (wc)))
-# define iswprint(wc) \
-  (__extension__							      \
-    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'		      \
-     ? (int) (__ctype32_b[(wint_t) (wc)] & _ISwprint) : iswprint (wc)))
-# define iswpunct(wc) \
-  (__extension__							      \
-    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'		      \
-     ? (int) (__ctype32_b[(wint_t) (wc)] & _ISwpunct) : iswpunct (wc)))
-# define iswspace(wc) \
-  (__extension__							      \
-    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'		      \
-     ? (int) (__ctype32_b[(wint_t) (wc)] & _ISwspace) : iswspace (wc)))
-# define iswupper(wc) \
-  (__extension__							      \
-    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'		      \
-     ? (int) (__ctype32_b[(wint_t) (wc)] & _ISwupper) : iswupper (wc)))
-# define iswxdigit(wc) \
-  (__extension__							      \
-    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'		      \
-     ? (int) (__ctype32_b[(wint_t) (wc)] & _ISwxdigit) : iswxdigit (wc)))
-
-# ifdef __USE_ISOC99
-#  define iswblank(wc) \
-  (__extension__							      \
-    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'		      \
-     ? (int) (__ctype32_b[(wint_t) (wc)] & _ISwblank) : iswblank (wc)))
-# endif
-
-#endif	/* gcc && optimizing */
 
 /*
  * Wide-character case-mapping functions: 7.15.3.1.
@@ -270,24 +212,6 @@ extern wint_t towlower (wint_t __wc) __THROW;
 extern wint_t towupper (wint_t __wc) __THROW;
 __END_NAMESPACE_C99
 
-#if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus
-/* The tables are always organized in a way which allows direct access
-   for single byte characters.  */
-extern const wint_t *__ctype32_tolower;
-extern const wint_t *__ctype32_toupper;
-
-# define towlower(wc) \
-  (__extension__							      \
-    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'		      \
-     ? (wint_t) __ctype32_tolower[(wint_t) (wc)] : towlower (wc)))
-
-# define towupper(wc) \
-  (__extension__							      \
-    (__builtin_constant_p (wc) && (wint_t) (wc) <= L'\xff'		      \
-     ? (wint_t) __ctype32_toupper[(wint_t) (wc)] : towupper (wc)))
-
-#endif	/* gcc && optimizing */
-
 __END_DECLS
 
 #endif	/* need iswxxx.  */