From d77478a5e53bc1c1daa08c675e87524193c39de2 Mon Sep 17 00:00:00 2001 From: Jerry Quinn Date: Fri, 21 Feb 2003 08:34:18 +0000 Subject: [PATCH] locale_facets.tcc (_M_convert_float): Replace numpunct facet accesses with data from __locale_cache. 2003-02-21 Jerry Quinn * include/bits/locale_facets.tcc (_M_convert_float): Replace numpunct facet accesses with data from __locale_cache. From-SVN: r63213 --- libstdc++-v3/ChangeLog | 6 +++++- libstdc++-v3/include/bits/locale_facets.tcc | 11 ++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index fb3b77fa405..9081936787b 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2003-02-21 Jerry Quinn + + * include/bits/locale_facets.tcc (_M_convert_float): Replace + numpunct facet accesses with data from __locale_cache. + 2003-02-20 Phil Edwards * docs/html/faq/index.html (3.9): New note, wchar_t on FreeBSD. @@ -60,7 +65,6 @@ cache literal string, grouping flag, thousands separator. (__locale_cache<_CharT>::__locale_cache): New. (__locale_cache<_CharT>::_M_init): New. - (__locale_cache<_CharT>::_M_populate): New. * src/ios.cc: Clear _M_locale_cache in constructor. * src/locale-inst.cc (__locale_cache, __locale_cache<_char_t>): New. diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc index 857074f976f..cb6dccd19e6 100644 --- a/libstdc++-v3/include/bits/locale_facets.tcc +++ b/libstdc++-v3/include/bits/locale_facets.tcc @@ -872,6 +872,9 @@ namespace std else if (__prec < static_cast(0)) __prec = static_cast(6); + typedef __locale_cache<_CharT> __cache_type; + __cache_type& __lc = static_cast<__cache_type&>(__io._M_cache()); + // [22.2.2.2.2] Stage 1, numeric conversion to character. int __len; // Long enough for the max format spec. @@ -917,7 +920,6 @@ namespace std // numpunct.decimal_point() values for '.' and adding grouping. const locale __loc = __io.getloc(); const ctype<_CharT>& __ctype = use_facet >(__loc); - const numpunct<_CharT>& __np = use_facet >(__loc); _CharT* __ws = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __len)); @@ -925,21 +927,20 @@ namespace std // Replace decimal point. const _CharT __cdec = __ctype.widen('.'); - const _CharT __dec = __np.decimal_point(); + const _CharT __dec = __lc._M_decimal_point; const _CharT* __p; if (__p = char_traits<_CharT>::find(__ws, __len, __cdec)) __ws[__p - __ws] = __dec; // Add grouping, if necessary. _CharT* __ws2; - const string __grouping = __np.grouping(); - if (__grouping.size()) + if (__lc._M_use_grouping) { // Grouping can add (almost) as many separators as the // number of digits, but no more. __ws2 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __len * 2)); - _M_group_float(__grouping, __np.thousands_sep(), __p, + _M_group_float(__lc._M_grouping, __lc._M_thousands_sep, __p, __ws2, __ws, __len); __ws = __ws2; } -- 2.30.2