diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-01-04 18:34:27 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-01-04 18:34:27 +0000 |
commit | 1724ec2f75ad0387f12a4bbd6f935f1b6eee2deb (patch) | |
tree | 19a818a24f648bd274212772f0223efb4727bb56 /libstdc++-v3 | |
parent | 611e540558f5132bdcee510e0ac6004a5e943b46 (diff) | |
download | ppe42-gcc-1724ec2f75ad0387f12a4bbd6f935f1b6eee2deb.tar.gz ppe42-gcc-1724ec2f75ad0387f12a4bbd6f935f1b6eee2deb.zip |
2004-01-04 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/numeric_members.cc (_M_initialize_numpunct):
Avoid unnecessarily zero terminating _M_atoms_out and _M_atoms_in;
always use double underscored names.
* config/locale/gnu/numeric_members.cc (_M_initialize_numpunct):
Likewise.
* include/bits/locale_facets.h (struct __numpunct_cache):
Dimension _M_atoms_out and _M_atoms_in one position smaller.
(__numpunct_cache<>::_M_cache): Don't zero terminate _M_atoms_out
and _M_atoms_in.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@75393 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 12 | ||||
-rw-r--r-- | libstdc++-v3/config/locale/generic/numeric_members.cc | 26 | ||||
-rw-r--r-- | libstdc++-v3/config/locale/gnu/numeric_members.cc | 26 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/locale_facets.h | 8 |
4 files changed, 37 insertions, 35 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 4a976be6ccb..a2c78c0e6b5 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,15 @@ +2004-01-04 Paolo Carlini <pcarlini@suse.de> + + * config/locale/generic/numeric_members.cc (_M_initialize_numpunct): + Avoid unnecessarily zero terminating _M_atoms_out and _M_atoms_in; + always use double underscored names. + * config/locale/gnu/numeric_members.cc (_M_initialize_numpunct): + Likewise. + * include/bits/locale_facets.h (struct __numpunct_cache): + Dimension _M_atoms_out and _M_atoms_in one position smaller. + (__numpunct_cache<>::_M_cache): Don't zero terminate _M_atoms_out + and _M_atoms_in. + 2003-12-31 Paolo Carlini <pcarlini@suse.de> * include/bits/locale_facets.tcc (num_get::_M_extract_int, diff --git a/libstdc++-v3/config/locale/generic/numeric_members.cc b/libstdc++-v3/config/locale/generic/numeric_members.cc index 09af14703b1..8af127b8644 100644 --- a/libstdc++-v3/config/locale/generic/numeric_members.cc +++ b/libstdc++-v3/config/locale/generic/numeric_members.cc @@ -1,6 +1,6 @@ // std::numpunct implementation details, generic version -*- C++ -*- -// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -51,13 +51,11 @@ namespace std _M_data->_M_decimal_point = '.'; _M_data->_M_thousands_sep = ','; - for (size_t i = 0; i < __num_base::_S_oend; ++i) - _M_data->_M_atoms_out[i] = __num_base::_S_atoms_out[i]; - _M_data->_M_atoms_out[__num_base::_S_oend] = char(); + for (size_t __i = 0; __i < __num_base::_S_oend; ++__i) + _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i]; - for (size_t i = 0; i < __num_base::_S_iend; ++i) - _M_data->_M_atoms_in[i] = __num_base::_S_atoms_in[i]; - _M_data->_M_atoms_in[__num_base::_S_iend] = char(); + for (size_t __i = 0; __i < __num_base::_S_iend; ++__i) + _M_data->_M_atoms_in[__i] = __num_base::_S_atoms_in[__i]; _M_data->_M_truename = "true"; _M_data->_M_falsename = "false"; @@ -84,19 +82,17 @@ namespace std // Use ctype::widen code without the facet... unsigned char uc; - for (size_t i = 0; i < __num_base::_S_oend; ++i) + for (size_t __i = 0; __i < __num_base::_S_oend; ++__i) { - uc = static_cast<unsigned char>(__num_base::_S_atoms_out[i]); - _M_data->_M_atoms_out[i] = btowc(uc); + uc = static_cast<unsigned char>(__num_base::_S_atoms_out[__i]); + _M_data->_M_atoms_out[__i] = btowc(uc); } - _M_data->_M_atoms_out[__num_base::_S_oend] = wchar_t(); - for (size_t i = 0; i < __num_base::_S_iend; ++i) + for (size_t __i = 0; __i < __num_base::_S_iend; ++__i) { - uc = static_cast<unsigned char>(__num_base::_S_atoms_in[i]); - _M_data->_M_atoms_in[i] = btowc(uc); + uc = static_cast<unsigned char>(__num_base::_S_atoms_in[__i]); + _M_data->_M_atoms_in[__i] = btowc(uc); } - _M_data->_M_atoms_in[__num_base::_S_iend] = wchar_t(); _M_data->_M_truename = L"true"; _M_data->_M_falsename = L"false"; diff --git a/libstdc++-v3/config/locale/gnu/numeric_members.cc b/libstdc++-v3/config/locale/gnu/numeric_members.cc index d97f0dc6f50..bc7711a7e55 100644 --- a/libstdc++-v3/config/locale/gnu/numeric_members.cc +++ b/libstdc++-v3/config/locale/gnu/numeric_members.cc @@ -1,6 +1,6 @@ // std::numpunct implementation details, GNU version -*- C++ -*- -// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -54,13 +54,11 @@ namespace std _M_data->_M_decimal_point = '.'; _M_data->_M_thousands_sep = ','; - for (size_t i = 0; i < __num_base::_S_oend; ++i) - _M_data->_M_atoms_out[i] = __num_base::_S_atoms_out[i]; - _M_data->_M_atoms_out[__num_base::_S_oend] = char(); + for (size_t __i = 0; __i < __num_base::_S_oend; ++__i) + _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i]; - for (size_t i = 0; i < __num_base::_S_iend; ++i) - _M_data->_M_atoms_in[i] = __num_base::_S_atoms_in[i]; - _M_data->_M_atoms_in[__num_base::_S_iend] = char(); + for (size_t __i = 0; __i < __num_base::_S_iend; ++__i) + _M_data->_M_atoms_in[__i] = __num_base::_S_atoms_in[__i]; } else { @@ -107,19 +105,17 @@ namespace std #endif // Use ctype::widen code without the facet... unsigned char uc; - for (size_t i = 0; i < __num_base::_S_oend; ++i) + for (size_t __i = 0; __i < __num_base::_S_oend; ++__i) { - uc = static_cast<unsigned char>(__num_base::_S_atoms_out[i]); - _M_data->_M_atoms_out[i] = btowc(uc); + uc = static_cast<unsigned char>(__num_base::_S_atoms_out[__i]); + _M_data->_M_atoms_out[__i] = btowc(uc); } - _M_data->_M_atoms_out[__num_base::_S_oend] = wchar_t(); - for (size_t i = 0; i < __num_base::_S_iend; ++i) + for (size_t __i = 0; __i < __num_base::_S_iend; ++__i) { - uc = static_cast<unsigned char>(__num_base::_S_atoms_in[i]); - _M_data->_M_atoms_in[i] = btowc(uc); + uc = static_cast<unsigned char>(__num_base::_S_atoms_in[__i]); + _M_data->_M_atoms_in[__i] = btowc(uc); } - _M_data->_M_atoms_in[__num_base::_S_iend] = wchar_t(); #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) __uselocale(__old); #endif diff --git a/libstdc++-v3/include/bits/locale_facets.h b/libstdc++-v3/include/bits/locale_facets.h index 2d3f776b26f..bf642780193 100644 --- a/libstdc++-v3/include/bits/locale_facets.h +++ b/libstdc++-v3/include/bits/locale_facets.h @@ -1,6 +1,6 @@ // Locale support -*- C++ -*- -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -1612,13 +1612,13 @@ namespace std // "C" locale, this is "-+xX0123456789abcdef0123456789ABCDEF". // This array contains the chars after having been passed // through the current locale's ctype<_CharT>.widen(). - _CharT _M_atoms_out[__num_base::_S_oend + 1]; + _CharT _M_atoms_out[__num_base::_S_oend]; // A list of valid numeric literals for input: in the standard // "C" locale, this is "-+xX0123456789abcdefABCDEF" // This array contains the chars after having been passed // through the current locale's ctype<_CharT>.widen(). - _CharT _M_atoms_in[__num_base::_S_iend + 1]; + _CharT _M_atoms_in[__num_base::_S_iend]; bool _M_allocated; @@ -1668,10 +1668,8 @@ namespace std const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__loc); __ct.widen(__num_base::_S_atoms_out, __num_base::_S_atoms_out + __num_base::_S_oend, _M_atoms_out); - _M_atoms_out[__num_base::_S_oend] = _CharT(); __ct.widen(__num_base::_S_atoms_in, __num_base::_S_atoms_in + __num_base::_S_iend, _M_atoms_in); - _M_atoms_in[__num_base::_S_iend] = _CharT(); } template<typename _CharT> |