From aeeac9ca5490d7d90fe061ab72da446c01ddf746 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 27 May 2015 15:54:47 -0400 Subject: implement fail-safe static locales for newlocale this frees applications which need to make temporary use of the C locale (via uselocale) from the possibility that newlocale might fail. the C.UTF-8 locale is also provided as a static locale. presently they behave the same, but this may change in the future. --- src/locale/locale_map.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/locale/locale_map.c') diff --git a/src/locale/locale_map.c b/src/locale/locale_map.c index 30aa7fcc..4346bb02 100644 --- a/src/locale/locale_map.c +++ b/src/locale/locale_map.c @@ -26,7 +26,7 @@ static const char envvars[][12] = { static const uint32_t empty_mo[] = { 0x950412de, 0, -1, -1, -1 }; -static const struct __locale_map c_dot_utf8 = { +const struct __locale_map __c_dot_utf8 = { .map = empty_mo, .map_size = sizeof empty_mo, .name = "C.UTF-8" @@ -58,7 +58,7 @@ const struct __locale_map *__get_locale(int cat, const char *val) if (builtin) { if (cat == LC_CTYPE && val[1]=='.') - return (void *)&c_dot_utf8; + return (void *)&__c_dot_utf8; return 0; } @@ -117,7 +117,7 @@ const struct __locale_map *__get_locale(int cat, const char *val) /* For LC_CTYPE, never return a null pointer unless the * requested name was "C" or "POSIX". */ - if (!new && cat == LC_CTYPE) new = (void *)&c_dot_utf8; + if (!new && cat == LC_CTYPE) new = (void *)&__c_dot_utf8; UNLOCK(lock); return new; -- cgit v1.2.1