Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc Remove most LC_CTYPE specific parts of locale.cache.



details:   https://anonhg.NetBSD.org/src/rev/134b81132023
branches:  trunk
changeset: 789478:134b81132023
user:      joerg <joerg%NetBSD.org@localhost>
date:      Mon Aug 19 22:43:28 2013 +0000

description:
Remove most LC_CTYPE specific parts of locale.cache.

diffstat:

 lib/libc/citrus/citrus_lc_ctype.c |  12 ++----------
 lib/libc/gen/isctype.c            |  20 +++++++++++---------
 lib/libc/locale/global_locale.c   |  20 ++------------------
 lib/libc/locale/setlocale_local.h |   9 +--------
 4 files changed, 16 insertions(+), 45 deletions(-)

diffs (185 lines):

diff -r d5330cfd001f -r 134b81132023 lib/libc/citrus/citrus_lc_ctype.c
--- a/lib/libc/citrus/citrus_lc_ctype.c Mon Aug 19 22:34:41 2013 +0000
+++ b/lib/libc/citrus/citrus_lc_ctype.c Mon Aug 19 22:43:28 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: citrus_lc_ctype.c,v 1.12 2013/08/18 20:03:48 joerg Exp $ */
+/* $NetBSD: citrus_lc_ctype.c,v 1.13 2013/08/19 22:43:28 joerg Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: citrus_lc_ctype.c,v 1.12 2013/08/18 20:03:48 joerg Exp $");
+__RCSID("$NetBSD: citrus_lc_ctype.c,v 1.13 2013/08/19 22:43:28 joerg Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "reentrant.h"
@@ -103,15 +103,7 @@
        _DIAGASSERT(cache->items != NULL);
        _DIAGASSERT(data != NULL);
 
-       cache->ctype_tab = data->rl_ctype_tab;
-       cache->tolower_tab = data->rl_tolower_tab;
-       cache->toupper_tab = data->rl_toupper_tab;
-       cache->mb_cur_max = _citrus_ctype_get_mb_cur_max(data->rl_citrus_ctype);
        cache->items[(size_t)CODESET] = data->rl_codeset;
-
-#ifdef __BUILD_LEGACY
-       cache->compat_bsdctype = data->rl_compat_bsdctype;
-#endif
 }
 
 static __inline void
diff -r d5330cfd001f -r 134b81132023 lib/libc/gen/isctype.c
--- a/lib/libc/gen/isctype.c    Mon Aug 19 22:34:41 2013 +0000
+++ b/lib/libc/gen/isctype.c    Mon Aug 19 22:43:28 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isctype.c,v 1.24 2013/05/17 12:55:57 joerg Exp $ */
+/* $NetBSD: isctype.c,v 1.25 2013/08/19 22:43:28 joerg Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: isctype.c,v 1.24 2013/05/17 12:55:57 joerg Exp $");
+__RCSID("$NetBSD: isctype.c,v 1.25 2013/08/19 22:43:28 joerg Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -44,20 +44,22 @@
 #error "EOF != -1"
 #endif
 
+#include "runetype_local.h"
 #include "setlocale_local.h"
 
-#define _CTYPE_TAB(table, i)   ((_current_cache()->table + 1)[i])
+#define _RUNE_LOCALE(loc) \
+    ((_RuneLocale *)((loc)->part_impl[(size_t)LC_CTYPE]))
 
 #define _ISCTYPE_FUNC(name, bit) \
 int \
 is##name(int c) \
 { \
-       return (int)(_CTYPE_TAB(ctype_tab, c) & (bit)); \
+       return (int)_ctype_tab_[c + 1] & (bit); \
 } \
 int \
 is##name ## _l(int c, locale_t loc) \
 { \
-       return (int)(((loc->cache->ctype_tab + 1)[c]) & (bit)); \
+       return (int)((_RUNE_LOCALE(loc)->rl_ctype_tab[c + 1]) & (bit)); \
 }
 
 _ISCTYPE_FUNC(alnum, (_CTYPE_A|_CTYPE_D))
@@ -76,25 +78,25 @@
 int
 toupper(int c)
 {
-       return (int)_CTYPE_TAB(toupper_tab, c);
+       return (int)_toupper_tab_[c + 1];
 }
 
 int
 toupper_l(int c, locale_t loc)
 {
-       return (int)(((loc->cache->toupper_tab + 1)[c]));
+       return (int)(_RUNE_LOCALE(loc)->rl_toupper_tab[c + 1]);
 }
 
 int
 tolower(int c)
 {
-       return (int)_CTYPE_TAB(tolower_tab, c);
+       return (int)_tolower_tab_[c + 1];
 }
 
 int
 tolower_l(int c, locale_t loc)
 {
-       return (int)(((loc->cache->tolower_tab + 1)[c]));
+       return (int)(_RUNE_LOCALE(loc)->rl_tolower_tab[c + 1]);
 }
 
 int
diff -r d5330cfd001f -r 134b81132023 lib/libc/locale/global_locale.c
--- a/lib/libc/locale/global_locale.c   Mon Aug 19 22:34:41 2013 +0000
+++ b/lib/libc/locale/global_locale.c   Mon Aug 19 22:43:28 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: global_locale.c,v 1.18 2013/08/18 20:03:48 joerg Exp $ */
+/* $NetBSD: global_locale.c,v 1.19 2013/08/19 22:43:28 joerg Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: global_locale.c,v 1.18 2013/08/18 20:03:48 joerg Exp $");
+__RCSID("$NetBSD: global_locale.c,v 1.19 2013/08/19 22:43:28 joerg Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
@@ -198,16 +198,8 @@
 };
 
 static struct _locale_cache_t _global_cache = {
-    .ctype_tab = (const unsigned short *)&_C_ctype_tab_[0],
-    .tolower_tab = (const short *)&_C_tolower_tab_[0],
-    .toupper_tab = (const short *)&_C_toupper_tab_[0],
-    .mb_cur_max = (size_t)1,
     .ldata = __UNCONST(&_C_ldata),
     .items = __UNCONST(&_C_items[0]),
-
-#ifdef __BUILD_LEGACY
-    .compat_bsdctype = (const unsigned char *)&_C_compat_bsdctype[0],
-#endif
 };
 
 __dso_protected struct _locale _lc_global_locale = {
@@ -239,16 +231,8 @@
 };
 
 static const struct _locale_cache_t _C_cache = {
-    .ctype_tab = (const unsigned short *)&_C_ctype_tab_[0],
-    .tolower_tab = (const short *)&_C_tolower_tab_[0],
-    .toupper_tab = (const short *)&_C_toupper_tab_[0],
-    .mb_cur_max = (size_t)1,
     .ldata = __UNCONST(&_C_ldata),
     .items = __UNCONST(&_C_items[0]),
-
-#ifdef __BUILD_LEGACY
-    .compat_bsdctype = (const unsigned char *)&_C_compat_bsdctype[0],
-#endif
 };
 
 __dso_protected const struct _locale _lc_C_locale = {
diff -r d5330cfd001f -r 134b81132023 lib/libc/locale/setlocale_local.h
--- a/lib/libc/locale/setlocale_local.h Mon Aug 19 22:34:41 2013 +0000
+++ b/lib/libc/locale/setlocale_local.h Mon Aug 19 22:43:28 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: setlocale_local.h,v 1.12 2013/05/17 12:55:57 joerg Exp $ */
+/* $NetBSD: setlocale_local.h,v 1.13 2013/08/19 22:43:28 joerg Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -42,15 +42,8 @@
 typedef void *_locale_part_t;
 
 struct _locale_cache_t {
-       const unsigned short *ctype_tab;
-       const short *tolower_tab;
-       const short *toupper_tab;
-       size_t mb_cur_max;
        struct lconv *ldata;
        const char **items;
-#ifdef __BUILD_LEGACY
-       const unsigned char *compat_bsdctype;
-#endif
 };
 
 struct _locale {



Home | Main Index | Thread Index | Old Index