From: handa Date: Fri, 5 Nov 2010 11:20:41 +0000 (+0000) Subject: (make_locale): Don't call setlocale. Just parse the arg NAME. X-Git-Tag: REL-1-6-3-RC~27 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=4bc3d94abf8d9df4736c41cd7ab91bfd4d5c14fc;p=m17n%2Fm17n-lib.git (make_locale): Don't call setlocale. Just parse the arg NAME. --- 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; }