Module Name: src Committed By: joerg Date: Mon Aug 19 22:43:28 UTC 2013
Modified Files: src/lib/libc/citrus: citrus_lc_ctype.c src/lib/libc/gen: isctype.c src/lib/libc/locale: global_locale.c setlocale_local.h Log Message: Remove most LC_CTYPE specific parts of locale.cache. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/lib/libc/citrus/citrus_lc_ctype.c cvs rdiff -u -r1.24 -r1.25 src/lib/libc/gen/isctype.c cvs rdiff -u -r1.18 -r1.19 src/lib/libc/locale/global_locale.c cvs rdiff -u -r1.12 -r1.13 src/lib/libc/locale/setlocale_local.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/citrus/citrus_lc_ctype.c diff -u src/lib/libc/citrus/citrus_lc_ctype.c:1.12 src/lib/libc/citrus/citrus_lc_ctype.c:1.13 --- src/lib/libc/citrus/citrus_lc_ctype.c:1.12 Sun Aug 18 20:03:48 2013 +++ src/lib/libc/citrus/citrus_lc_ctype.c Mon Aug 19 22:43:28 2013 @@ -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 @@ _PREFIX(build_cache)(struct _locale_cach _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 Index: src/lib/libc/gen/isctype.c diff -u src/lib/libc/gen/isctype.c:1.24 src/lib/libc/gen/isctype.c:1.25 --- src/lib/libc/gen/isctype.c:1.24 Fri May 17 12:55:57 2013 +++ src/lib/libc/gen/isctype.c Mon Aug 19 22:43:28 2013 @@ -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 @@ __RCSID("$NetBSD: isctype.c,v 1.24 2013/ #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 @@ _ISCTYPE_FUNC(xdigit, _CTYPE_X) 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 Index: src/lib/libc/locale/global_locale.c diff -u src/lib/libc/locale/global_locale.c:1.18 src/lib/libc/locale/global_locale.c:1.19 --- src/lib/libc/locale/global_locale.c:1.18 Sun Aug 18 20:03:48 2013 +++ src/lib/libc/locale/global_locale.c Mon Aug 19 22:43:28 2013 @@ -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 const char * const _C_items [(siz }; 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 @@ __dso_protected struct _locale _lc_globa }; 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 = { Index: src/lib/libc/locale/setlocale_local.h diff -u src/lib/libc/locale/setlocale_local.h:1.12 src/lib/libc/locale/setlocale_local.h:1.13 --- src/lib/libc/locale/setlocale_local.h:1.12 Fri May 17 12:55:57 2013 +++ src/lib/libc/locale/setlocale_local.h Mon Aug 19 22:43:28 2013 @@ -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 @@ extern const char *_PathLocale; 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 {