Commit 17fa5560 by Paolo Carlini Committed by Paolo Carlini

numeric_members.cc (_M_initialize_numpunct): Avoid unnecessarily zero…

numeric_members.cc (_M_initialize_numpunct): Avoid unnecessarily zero terminating _M_atoms_out and _M_atoms_in...

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.

From-SVN: r75393
parent dc0bfe6a
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> 2003-12-31 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.tcc (num_get::_M_extract_int, * include/bits/locale_facets.tcc (num_get::_M_extract_int,
......
// std::numpunct implementation details, generic version -*- C++ -*- // 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 // 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 // software; you can redistribute it and/or modify it under the
...@@ -51,13 +51,11 @@ namespace std ...@@ -51,13 +51,11 @@ namespace std
_M_data->_M_decimal_point = '.'; _M_data->_M_decimal_point = '.';
_M_data->_M_thousands_sep = ','; _M_data->_M_thousands_sep = ',';
for (size_t i = 0; i < __num_base::_S_oend; ++i) 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[__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_iend; ++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[__i] = __num_base::_S_atoms_in[__i];
_M_data->_M_atoms_in[__num_base::_S_iend] = char();
_M_data->_M_truename = "true"; _M_data->_M_truename = "true";
_M_data->_M_falsename = "false"; _M_data->_M_falsename = "false";
...@@ -84,19 +82,17 @@ namespace std ...@@ -84,19 +82,17 @@ namespace std
// Use ctype::widen code without the facet... // Use ctype::widen code without the facet...
unsigned char uc; 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]); uc = static_cast<unsigned char>(__num_base::_S_atoms_out[__i]);
_M_data->_M_atoms_out[i] = btowc(uc); _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]); uc = static_cast<unsigned char>(__num_base::_S_atoms_in[__i]);
_M_data->_M_atoms_in[i] = btowc(uc); _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_truename = L"true";
_M_data->_M_falsename = L"false"; _M_data->_M_falsename = L"false";
......
// std::numpunct implementation details, GNU version -*- C++ -*- // 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 // 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 // software; you can redistribute it and/or modify it under the
...@@ -54,13 +54,11 @@ namespace std ...@@ -54,13 +54,11 @@ namespace std
_M_data->_M_decimal_point = '.'; _M_data->_M_decimal_point = '.';
_M_data->_M_thousands_sep = ','; _M_data->_M_thousands_sep = ',';
for (size_t i = 0; i < __num_base::_S_oend; ++i) 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[__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_iend; ++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[__i] = __num_base::_S_atoms_in[__i];
_M_data->_M_atoms_in[__num_base::_S_iend] = char();
} }
else else
{ {
...@@ -107,19 +105,17 @@ namespace std ...@@ -107,19 +105,17 @@ namespace std
#endif #endif
// Use ctype::widen code without the facet... // Use ctype::widen code without the facet...
unsigned char uc; 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]); uc = static_cast<unsigned char>(__num_base::_S_atoms_out[__i]);
_M_data->_M_atoms_out[i] = btowc(uc); _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]); uc = static_cast<unsigned char>(__num_base::_S_atoms_in[__i]);
_M_data->_M_atoms_in[i] = btowc(uc); _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) #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
__uselocale(__old); __uselocale(__old);
#endif #endif
......
// Locale support -*- C++ -*- // 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. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -1612,13 +1612,13 @@ namespace std ...@@ -1612,13 +1612,13 @@ namespace std
// "C" locale, this is "-+xX0123456789abcdef0123456789ABCDEF". // "C" locale, this is "-+xX0123456789abcdef0123456789ABCDEF".
// This array contains the chars after having been passed // This array contains the chars after having been passed
// through the current locale's ctype<_CharT>.widen(). // 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 // A list of valid numeric literals for input: in the standard
// "C" locale, this is "-+xX0123456789abcdefABCDEF" // "C" locale, this is "-+xX0123456789abcdefABCDEF"
// This array contains the chars after having been passed // This array contains the chars after having been passed
// through the current locale's ctype<_CharT>.widen(). // 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; bool _M_allocated;
...@@ -1668,10 +1668,8 @@ namespace std ...@@ -1668,10 +1668,8 @@ namespace std
const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__loc); const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__loc);
__ct.widen(__num_base::_S_atoms_out, __ct.widen(__num_base::_S_atoms_out,
__num_base::_S_atoms_out + __num_base::_S_oend, _M_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, __ct.widen(__num_base::_S_atoms_in,
__num_base::_S_atoms_in + __num_base::_S_iend, _M_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> template<typename _CharT>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment