diff options
author | Jakub Jelinek <jakub@redhat.com> | 2002-09-05 09:51:16 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2002-09-05 09:51:16 +0200 |
commit | 9a6d20712ba05d64e03f7252c5b145494ce7937e (patch) | |
tree | d46938e5d719510f6d041d816b8a76e105b9fd11 | |
parent | 89671b70677af6d2f66c48cd9e2f703fc8e0444b (diff) | |
download | gcc-9a6d20712ba05d64e03f7252c5b145494ce7937e.zip gcc-9a6d20712ba05d64e03f7252c5b145494ce7937e.tar.gz gcc-9a6d20712ba05d64e03f7252c5b145494ce7937e.tar.bz2 |
monetary_members.cc (moneypunct<wchar_t, [...]): Use __uselocale instead of setlocale for glibc 2.3.
* config/locale/gnu/monetary_members.cc
(moneypunct<wchar_t, true>::_M_initialize_moneypunct,
moneypunct<wchar_t, false>::_M_initialize_moneypunct): Use
__uselocale instead of setlocale for glibc 2.3.
From-SVN: r56839
-rw-r--r-- | libstdc++-v3/ChangeLog | 7 | ||||
-rw-r--r-- | libstdc++-v3/config/locale/gnu/monetary_members.cc | 22 |
2 files changed, 25 insertions, 4 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index f3dd059..06cf2a0 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,12 @@ 2002-09-05 Jakub Jelinek <jakub@redhat.com> + * config/locale/gnu/monetary_members.cc + (moneypunct<wchar_t, true>::_M_initialize_moneypunct, + moneypunct<wchar_t, false>::_M_initialize_moneypunct): Use + __uselocale instead of setlocale for glibc 2.3. + +2002-09-05 Jakub Jelinek <jakub@redhat.com> + * config/locale/generic/c++locale_internal.h: New header. * config/locale/gnu/c++locale_internal.h: New header. * config/locale/gnu/c_locale.cc: Include it. diff --git a/libstdc++-v3/config/locale/gnu/monetary_members.cc b/libstdc++-v3/config/locale/gnu/monetary_members.cc index bc915af..68b154b 100644 --- a/libstdc++-v3/config/locale/gnu/monetary_members.cc +++ b/libstdc++-v3/config/locale/gnu/monetary_members.cc @@ -335,9 +335,13 @@ namespace std else { // Named locale. - // XXX Fix me. Switch to named locale so that mbsrtowcs will work. +#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) + __c_locale __old = __uselocale(__cloc); +#else + // Switch to named locale so that mbsrtowcs will work. char* __old = strdup(setlocale(LC_ALL, NULL)); setlocale(LC_ALL, __name); +#endif _M_decimal_point = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc)}).__w); @@ -400,9 +404,12 @@ namespace std char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn); - // XXX +#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) + __uselocale(__old); +#else setlocale(LC_ALL, __old); free(__old); +#endif } } @@ -427,9 +434,13 @@ namespace std else { // Named locale. - // XXX Fix me. Switch to named locale so that mbsrtowcs will work. +#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) + __c_locale __old = __uselocale(__cloc); +#else + // Switch to named locale so that mbsrtowcs will work. char* __old = strdup(setlocale(LC_ALL, NULL)); setlocale(LC_ALL, __name); +#endif _M_decimal_point = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc)}).__w); _M_thousands_sep = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w); @@ -491,9 +502,12 @@ namespace std char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn); - // XXX +#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) + __uselocale(__old); +#else setlocale(LC_ALL, __old); free(__old); +#endif } } |