Mercurial > hg > xemacs-beta
comparison src/intl.c @ 2946:4a9a804b31cb
[xemacs-hg @ 2005-09-24 16:31:37 by olivierg]
2005-09-17 Olivier Galibert <galibert@xemacs.org>
* intl.c (Fset_current_locale): setlocale return string is valid
only until the next setlocale call.
author | olivierg |
---|---|
date | Sat, 24 Sep 2005 16:31:39 +0000 |
parents | 2b6fa2618f76 |
children | 98af8a976fc3 |
comparison
equal
deleted
inserted
replaced
2945:5b00db3049ec | 2946:4a9a804b31cb |
---|---|
68 Otherwise, returns the locale, or possibly a more-specified version. | 68 Otherwise, returns the locale, or possibly a more-specified version. |
69 */ | 69 */ |
70 (locale)) | 70 (locale)) |
71 { | 71 { |
72 Extbyte *loc; | 72 Extbyte *loc; |
73 Lisp_Object str; | |
73 | 74 |
74 CHECK_STRING (locale); | 75 CHECK_STRING (locale); |
75 /* RedHat 6.2 contains a locale called "Francais" with the C-cedilla | 76 /* RedHat 6.2 contains a locale called "Francais" with the C-cedilla |
76 encoded in ISO2022! */ | 77 encoded in ISO2022! */ |
77 LISP_STRING_TO_EXTERNAL (locale, loc, Qctext); | 78 LISP_STRING_TO_EXTERNAL (locale, loc, Qctext); |
78 loc = setlocale (LC_ALL, loc); | 79 loc = setlocale (LC_ALL, loc); |
79 setlocale (LC_NUMERIC, "C"); | |
80 if (!loc) | 80 if (!loc) |
81 return Qnil; | 81 return Qnil; |
82 loc = xstrdup (loc); | |
83 setlocale (LC_NUMERIC, "C"); | |
82 #ifdef HAVE_X_WINDOWS | 84 #ifdef HAVE_X_WINDOWS |
83 if (!init_x_locale (locale)) | 85 if (!init_x_locale (locale)) |
84 { | 86 { |
85 /* Locale not supported under X. Put it back. */ | 87 /* Locale not supported under X. Put it back. */ |
86 setlocale (LC_ALL, loc); | 88 setlocale (LC_ALL, loc); |
87 setlocale (LC_NUMERIC, "C"); | 89 setlocale (LC_NUMERIC, "C"); |
90 free (loc); | |
88 return Qnil; | 91 return Qnil; |
89 } | 92 } |
90 #endif | 93 #endif |
91 | 94 |
92 return build_ext_string (loc, Qctext); | 95 str = build_ext_string (loc, Qctext); |
96 xfree (loc, Extbyte *); | |
97 return str; | |
93 } | 98 } |
94 | 99 |
95 #if 0 | 100 #if 0 |
96 | 101 |
97 /* #### some old code that I really want to nuke, but I'm not completely | 102 /* #### some old code that I really want to nuke, but I'm not completely |