# HG changeset patch # User Garrett D'Amore # Date 1284482595 25200 # Node ID 668c57e2407898edea175984184ff6742e411afd # Parent d3448309c82d6393ff5649db18abdd2c11a4d7f2 187 locale -a dumps core Reviewed by: richlowe@richlowe.net, gwr@nexenta.com, vineeth@nexenta.com Approved by: gwr@nexenta.com diff -r d3448309c82d -r 668c57e24078 usr/src/lib/libc/port/locale/none.c --- a/usr/src/lib/libc/port/locale/none.c Tue Sep 14 12:50:00 2010 +0800 +++ b/usr/src/lib/libc/port/locale/none.c Tue Sep 14 09:43:15 2010 -0700 @@ -47,7 +47,6 @@ #include #include "runetype.h" #include "mblocal.h" -#include "../i18n/_locale.h" static size_t _none_mbrtowc(wchar_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t, mbstate_t *_RESTRICT_KYWD); @@ -64,28 +63,11 @@ /* setup defaults */ -extern unsigned char __ctype_C[]; - int _none_init(_RuneLocale *rl) { - /* - * We need to populate the ctype stuff. This means the - * tolower table, the type masks, etc. - * There are 257 entries for the type array, 257 entries for the - * tolower/toupper array, and 7 bytes for CSWIDTH array. - * - * We have to set this stuff up because for POSIX/C we short - * circuit most of the logic in setrunelocale that would handle it. - */ - (void) memcpy(__ctype, __ctype_C, SZ_TOTAL); - charset_is_ascii = 1; - __ctype_mask = rl->__runetype; - __trans_upper = rl->__mapupper; - __trans_lower = rl->__maplower; - __mbrtowc = _none_mbrtowc; __mbsinit = _none_mbsinit; __mbsnrtowcs = _none_mbsnrtowcs; diff -r d3448309c82d -r 668c57e24078 usr/src/lib/libc/port/locale/setrunelocale.c --- a/usr/src/lib/libc/port/locale/setrunelocale.c Tue Sep 14 12:50:00 2010 +0800 +++ b/usr/src/lib/libc/port/locale/setrunelocale.c Tue Sep 14 09:43:15 2010 -0700 @@ -48,8 +48,10 @@ #include "mblocal.h" #include "setlocale.h" #include "_ctype.h" +#include "../i18n/_locale.h" extern _RuneLocale *_Read_RuneMagi(FILE *); +extern unsigned char __ctype_C[]; static int __setrunelocale(const char *); @@ -89,6 +91,16 @@ * The "C" and "POSIX" locale are always here. */ if (strcmp(encoding, "C") == 0 || strcmp(encoding, "POSIX") == 0) { + int i; + + (void) memcpy(__ctype, __ctype_C, SZ_TOTAL); + + for (i = 0; i < _CACHED_RUNES; i++) { + __ctype_mask[i] = _DefaultRuneLocale.__runetype[i]; + __trans_upper[i] = _DefaultRuneLocale.__mapupper[i]; + __trans_lower[i] = _DefaultRuneLocale.__maplower[i]; + } + (void) _none_init(&_DefaultRuneLocale); return (0); }