2003-04-25 Benjamin Kosnik <bkoz@redhat.com>

* include/bits/locale_classes.h
	(locale::_S_extra_categories_size): Remove.
	* src/locale.cc: Remove _S_extra_categories_size.
	* src/localename.cc: Same.
	* config/locale/gnu/c_locale.cc: Same.
	* config/locale/generic/c_locale.cc: Same.

From-SVN: r66068
This commit is contained in:
Benjamin Kosnik 2003-04-25 17:23:21 +00:00 committed by Benjamin Kosnik
parent c4519773ca
commit 89e9920bd6
6 changed files with 27 additions and 39 deletions

View File

@ -1,3 +1,12 @@
2003-04-25 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/locale_classes.h
(locale::_S_extra_categories_size): Remove.
* src/locale.cc: Remove _S_extra_categories_size.
* src/localename.cc: Same.
* config/locale/gnu/c_locale.cc: Same.
* config/locale/generic/c_locale.cc: Same.
2003-04-24 Richard Sandiford <rsandifo@redhat.com> 2003-04-24 Richard Sandiford <rsandifo@redhat.com>
* src/localename.cc (__gnu_cxx::facet_vec): Correct types. * src/localename.cc (__gnu_cxx::facet_vec): Correct types.

View File

@ -228,8 +228,7 @@ namespace std
locale::facet::_S_clone_c_locale(__c_locale&) locale::facet::_S_clone_c_locale(__c_locale&)
{ return __c_locale(); } { return __c_locale(); }
const char* locale::_S_categories[_S_categories_size const char* locale::_S_categories[_S_categories_size] =
+ _S_extra_categories_size] =
{ {
"LC_CTYPE", "LC_CTYPE",
"LC_NUMERIC", "LC_NUMERIC",

View File

@ -187,8 +187,7 @@ namespace std
locale::facet::_S_clone_c_locale(__c_locale& __cloc) locale::facet::_S_clone_c_locale(__c_locale& __cloc)
{ return __duplocale(__cloc); } { return __duplocale(__cloc); }
const char* locale::_S_categories[_S_categories_size const char* locale::_S_categories[_S_categories_size] =
+ _S_extra_categories_size] =
{ {
"LC_CTYPE", "LC_CTYPE",
"LC_NUMERIC", "LC_NUMERIC",

View File

@ -146,21 +146,18 @@ namespace std
// directly correspond to ISO C99 macros LC_COLLATE, LC_CTYPE, // directly correspond to ISO C99 macros LC_COLLATE, LC_CTYPE,
// LC_MONETARY, LC_NUMERIC, and LC_TIME. In addition, POSIX (IEEE // LC_MONETARY, LC_NUMERIC, and LC_TIME. In addition, POSIX (IEEE
// 1003.1-2001) specifies LC_MESSAGES. // 1003.1-2001) specifies LC_MESSAGES.
static const size_t _S_categories_size = 6;
// In addition to the standard categories, the underlying // In addition to the standard categories, the underlying
// operating system is allowed to define extra LC_* // operating system is allowed to define extra LC_*
// macros. For GNU systems, the following are also valid: // macros. For GNU systems, the following are also valid:
// LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE, LC_MEASUREMENT, // LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE, LC_MEASUREMENT,
// and LC_IDENTIFICATION. // and LC_IDENTIFICATION.
static const size_t _S_extra_categories_size = _GLIBCPP_NUM_CATEGORIES; static const size_t _S_categories_size = 6 + _GLIBCPP_NUM_CATEGORIES;
// Names of underlying locale categories. // Names of underlying locale categories.
// NB: locale::global() has to know how to modify all the // NB: locale::global() has to know how to modify all the
// underlying categories, not just the ones required by the C++ // underlying categories, not just the ones required by the C++
// standard. // standard.
static const char* _S_categories[_S_categories_size static const char* _S_categories[_S_categories_size];
+ _S_extra_categories_size];
explicit explicit
locale(_Impl*) throw(); locale(_Impl*) throw();
@ -201,9 +198,7 @@ namespace std
_Atomic_word _M_references; _Atomic_word _M_references;
const facet** _M_facets; const facet** _M_facets;
size_t _M_facets_size; size_t _M_facets_size;
char* _M_names[_S_categories_size];
char* _M_names[_S_categories_size
+ _S_extra_categories_size];
static const locale::id* const _S_id_ctype[]; static const locale::id* const _S_id_ctype[];
static const locale::id* const _S_id_numeric[]; static const locale::id* const _S_id_numeric[];
static const locale::id* const _S_id_collate[]; static const locale::id* const _S_id_collate[];
@ -243,9 +238,7 @@ namespace std
_M_check_same_name() _M_check_same_name()
{ {
bool __ret = true; bool __ret = true;
for (size_t __i = 0; for (size_t __i = 0; __ret && __i < _S_categories_size - 1; ++__i)
__ret && __i < _S_categories_size + _S_extra_categories_size - 1;
++__i)
__ret &= (strcmp(_M_names[__i], _M_names[__i + 1]) == 0); __ret &= (strcmp(_M_names[__i], _M_names[__i + 1]) == 0);
return __ret; return __ret;
} }
@ -273,8 +266,7 @@ namespace std
{ {
_M_impl = new _Impl(*__other._M_impl, 1); _M_impl = new _Impl(*__other._M_impl, 1);
_M_impl->_M_install_facet(&_Facet::id, __f); _M_impl->_M_install_facet(&_Facet::id, __f);
for (size_t __i = 0; for (size_t __i = 0; __i < _S_categories_size ; ++__i)
__i < _S_categories_size + _S_extra_categories_size; ++__i)
{ {
delete [] _M_impl->_M_names[__i]; delete [] _M_impl->_M_names[__i];
char* __new = new char[2]; char* __new = new char[2];

View File

@ -62,7 +62,6 @@ namespace std
locale::_Impl* locale::_S_classic; locale::_Impl* locale::_S_classic;
locale::_Impl* locale::_S_global; locale::_Impl* locale::_S_global;
const size_t locale::_S_categories_size; const size_t locale::_S_categories_size;
const size_t locale::_S_extra_categories_size;
// Definitions for static const data members of locale::id // Definitions for static const data members of locale::id
_Atomic_word locale::id::_S_highwater; // init'd to 0 by linker _Atomic_word locale::id::_S_highwater; // init'd to 0 by linker
@ -208,8 +207,7 @@ namespace std
// different from LANG. // different from LANG.
size_t __i = 0; size_t __i = 0;
if (strcmp(__res, "C") == 0) if (strcmp(__res, "C") == 0)
for (; __i < _S_categories_size for (; __i < _S_categories_size ; ++__i)
+ _S_extra_categories_size; ++__i)
{ {
__env = getenv(_S_categories[__i]); __env = getenv(_S_categories[__i]);
if (__env && strcmp(__env, "") != 0 if (__env && strcmp(__env, "") != 0
@ -218,8 +216,7 @@ namespace std
break; break;
} }
else else
for (; __i < _S_categories_size for (; __i < _S_categories_size ; ++__i)
+ _S_extra_categories_size; ++__i)
{ {
__env = getenv(_S_categories[__i]); __env = getenv(_S_categories[__i]);
if (__env && strcmp(__env, "") != 0 if (__env && strcmp(__env, "") != 0
@ -229,7 +226,7 @@ namespace std
// If one is found, build the complete string of // If one is found, build the complete string of
// the form LC_CTYPE=xxx;LC_NUMERIC=yyy; and so on... // the form LC_CTYPE=xxx;LC_NUMERIC=yyy; and so on...
if (__i < _S_categories_size + _S_extra_categories_size) if (__i < _S_categories_size)
{ {
string __str; string __str;
for (size_t __j = 0; __j < __i; ++__j) for (size_t __j = 0; __j < __i; ++__j)
@ -244,8 +241,7 @@ namespace std
__str += __env; __str += __env;
__str += ';'; __str += ';';
__i++; __i++;
for (; __i < _S_categories_size for (; __i < _S_categories_size ; ++__i)
+ _S_extra_categories_size; ++__i)
{ {
__env = getenv(_S_categories[__i]); __env = getenv(_S_categories[__i]);
if (!__env || strcmp(__env, "") == 0) if (!__env || strcmp(__env, "") == 0)
@ -349,9 +345,7 @@ namespace std
__ret += _S_categories[0]; __ret += _S_categories[0];
__ret += '='; __ret += '=';
__ret += _M_impl->_M_names[0]; __ret += _M_impl->_M_names[0];
for (size_t __i = 1; for (size_t __i = 1; __i < _S_categories_size ; ++__i)
__i < _S_categories_size + _S_extra_categories_size;
++__i)
{ {
__ret += ';'; __ret += ';';
__ret += _S_categories[__i]; __ret += _S_categories[__i];

View File

@ -82,8 +82,7 @@ namespace std
_M_facets[__i]->_M_remove_reference(); _M_facets[__i]->_M_remove_reference();
delete [] _M_facets; delete [] _M_facets;
for (size_t __i = 0; for (size_t __i = 0; __i < _S_categories_size ; ++__i)
__i < _S_categories_size + _S_extra_categories_size; ++__i)
delete [] _M_names[__i]; delete [] _M_names[__i];
} }
@ -109,8 +108,7 @@ namespace std
if (_M_facets[__i]) if (_M_facets[__i])
_M_facets[__i]->_M_add_reference(); _M_facets[__i]->_M_add_reference();
} }
for (size_t __i = 0; for (size_t __i = 0; __i < _S_categories_size ; ++__i)
__i < _S_categories_size + _S_extra_categories_size; ++__i)
{ {
char* __new = new char[strlen(__imp._M_names[__i]) + 1]; char* __new = new char[strlen(__imp._M_names[__i]) + 1];
strcpy(__new, __imp._M_names[__i]); strcpy(__new, __imp._M_names[__i]);
@ -144,8 +142,7 @@ namespace std
size_t __len = strlen(__s); size_t __len = strlen(__s);
if (!strchr(__s, ';')) if (!strchr(__s, ';'))
{ {
for (size_t __i = 0; for (size_t __i = 0; __i < _S_categories_size ; ++__i)
__i < _S_categories_size + _S_extra_categories_size; ++__i)
{ {
_M_names[__i] = new char[__len + 1]; _M_names[__i] = new char[__len + 1];
strcpy(_M_names[__i], __s); strcpy(_M_names[__i], __s);
@ -154,8 +151,7 @@ namespace std
else else
{ {
const char* __beg = __s; const char* __beg = __s;
for (size_t __i = 0; for (size_t __i = 0; __i < _S_categories_size ; ++__i)
__i < _S_categories_size + _S_extra_categories_size; ++__i)
{ {
__beg = strchr(__beg, '=') + 1; __beg = strchr(__beg, '=') + 1;
const char* __end = strchr(__beg, ';'); const char* __end = strchr(__beg, ';');
@ -219,10 +215,9 @@ namespace std
_M_facets[__i] = 0; _M_facets[__i] = 0;
// Name all the categories. // Name all the categories.
for (size_t __i = 0; for (size_t __i = 0; __i < _S_categories_size ; ++__i)
__i < _S_categories_size + _S_extra_categories_size; ++__i)
{ {
_M_names[__i] = new (&facet_name[__i]) char[2]; _M_names[__i] = new (&facet_name[__i]) char[2];
strcpy(_M_names[__i], locale::facet::_S_c_name); strcpy(_M_names[__i], locale::facet::_S_c_name);
} }