]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Use __ctype32_tolower and __ctype32_toupper.
authorUlrich Drepper <drepper@redhat.com>
Sun, 13 Feb 2000 07:33:06 +0000 (07:33 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sun, 13 Feb 2000 07:33:06 +0000 (07:33 +0000)
wctype/wcfuncs.c
wctype/wcfuncs_l.c

index 30836edb9b7e7b4297fc273ac772c5f739200d4e..3caa9df74d609cf1baac1507c6d509925afc19ad 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -18,7 +18,7 @@
 
 #define        __NO_WCTYPE
 #include <wctype.h>
-#include <ctype.h>     /* For __ctype_tolower and __ctype_toupper.  */
+#include <stdint.h>
 
 #include "cname-lookup.h"
 
    is not visible in the header.   */
 extern unsigned int *__ctype32_b;
 
+/* These are not exported.  */
+extern const uint32_t *__ctype32_toupper;
+extern const uint32_t *__ctype32_tolower;
+
 /* Provide real-function versions of all the wctype macros.  */
 
 #define        func(name, type) \
@@ -76,7 +80,7 @@ wint_t
     /* Character is not known.  Default action is to simply return it.  */
     return wc;
 
-  return (wint_t) __ctype_tolower[idx];
+  return (wint_t) __ctype32_tolower[idx];
 }
 
 wint_t
@@ -90,5 +94,5 @@ wint_t
     /* Character is not known.  Default action is to simply return it.  */
     return wc;
 
-  return (wint_t) __ctype_toupper[idx];
+  return (wint_t) __ctype32_toupper[idx];
 }
index 775676eb38bafb8c2243ccb9e8856f100260ad77..1d194ee19b9a94527a24e01b2cd2d5f5b52c66e0 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
 
 #define        __NO_WCTYPE
 #include <wctype.h>
+#include <endian.h>
+#include <stdint.h>
+#include "../locale/localeinfo.h"
+
+#define USE_IN_EXTENDED_LOCALE_MODEL
+#include "cname-lookup.h"
 
 /* Provide real-function versions of all the wctype macros.  */
 
@@ -40,11 +46,41 @@ func (__iswxdigit_l, _ISwxdigit)
 wint_t
 (__towlower_l) (wint_t wc, __locale_t locale)
 {
-  return __towctrans_l (wc, locale->__ctype_tolower, locale);
+  const int32_t *class32_tolower;
+  size_t idx;
+
+  idx = cname_lookup (wc, locale);
+  if (idx == ~((size_t) 0))
+    return 0;
+
+#if BYTE_ORDER == BIG_ENDIAN
+  class32_tolower = (const int32_t *)
+    locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_TOLOWER32_EB)].string;
+#else
+  class32_tolower = (const int32_t *)
+    locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_TOLOWER32_EL)].string;
+#endif
+
+  return class32_tolower[idx];
 }
 
 wint_t
 (__towupper_l) (wint_t wc, __locale_t locale)
 {
-  return __towctrans_l (wc, locale->__ctype_toupper, locale);
+  const int32_t *class32_toupper;
+  size_t idx;
+
+  idx = cname_lookup (wc, locale);
+  if (idx == ~((size_t) 0))
+    return 0;
+
+#if BYTE_ORDER == BIG_ENDIAN
+  class32_toupper = (const int32_t *)
+    locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_TOUPPER32_EB)].string;
+#else
+  class32_toupper = (const int32_t *)
+    locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_TOUPPER32_EL)].string;
+#endif
+
+  return class32_toupper[idx];
 }