From 4bc3d94abf8d9df4736c41cd7ab91bfd4d5c14fc Mon Sep 17 00:00:00 2001 From: handa Date: Fri, 5 Nov 2010 11:20:41 +0000 Subject: [PATCH] (make_locale): Don't call setlocale. Just parse the arg NAME. --- src/locale.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/src/locale.c b/src/locale.c index f9c1f0e..05dbf46 100644 --- a/src/locale.c +++ b/src/locale.c @@ -86,34 +86,24 @@ MLocale *mlocale__messages, *mlocale__time; MLocale *mlocale_monetary, *mlocale_numeric, ; #endif -/** Parse locale name NAME and return a newly created MLocale object. - If the locale is not supported by the system, return NULL. */ +/** Parse locale name NAME and return a newly created MLocale object. */ static MLocale * make_locale (const char *name) { - char *current, *new, *str; + char *str; int len; MLocale *locale; char c; - str = setlocale (LC_CTYPE, NULL); - len = strlen (str) + 1; - current = alloca (len); - memcpy (current, str, len); - - if (! (new = setlocale (LC_CTYPE, name))) - return NULL; - - M17N_OBJECT (locale, NULL, MERROR_LOCALE); - locale->name = msymbol (new); + locale->name = msymbol (name); msymbol_put (locale->name, M_locale, (void *) locale); M17N_OBJECT_UNREF (locale); - len = strlen (new) + 1; + len = strlen (name) + 1; str = alloca (len); - memcpy (str, new, len); + memcpy (str, name, len); c = '\0'; while (1) @@ -162,8 +152,6 @@ make_locale (const char *name) } else locale->coding = Mcoding_us_ascii; - - setlocale (LC_CTYPE, current); return locale; } -- 1.7.10.4