about summary refs log tree commit diff
path: root/src/locale/locale_map.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-05-27 15:54:47 -0400
committerRich Felker <dalias@aerifal.cx>2015-05-27 15:54:47 -0400
commitaeeac9ca5490d7d90fe061ab72da446c01ddf746 (patch)
tree4f74e2fb42ef8ac46151fe9037c41bb8b5eff52b /src/locale/locale_map.c
parent11858d31aa020df3e7e7dedf49f9870ce12f31cc (diff)
downloadmusl-aeeac9ca5490d7d90fe061ab72da446c01ddf746.tar.gz
musl-aeeac9ca5490d7d90fe061ab72da446c01ddf746.tar.xz
musl-aeeac9ca5490d7d90fe061ab72da446c01ddf746.zip
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.
Diffstat (limited to 'src/locale/locale_map.c')
-rw-r--r--src/locale/locale_map.c6
1 files changed, 3 insertions, 3 deletions
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;