locale_classes.h (locale::facet::_S_get_c_name): Add.

2003-10-02  Benjamin Kosnik  <bkoz@redhat.com>

	* include/bits/locale_classes.h (locale::facet::_S_get_c_name): Add.
	* src/locale.cc: Define.
	* src/localename.cc: Use it.
	* config/locale/generic/time_members.h: Same.
	* config/locale/gnu/messages_members.h: Same.
	* config/locale/gnu/time_members.h: Same.

From-SVN: r72050
This commit is contained in:
Benjamin Kosnik 2003-10-02 23:06:13 +00:00 committed by Benjamin Kosnik
parent 8dcaff2850
commit bb1b12ec0a
7 changed files with 28 additions and 11 deletions

View File

@ -1,3 +1,12 @@
2003-10-02 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/locale_classes.h (locale::facet::_S_get_c_name): Add.
* src/locale.cc: Define.
* src/localename.cc: Use it.
* config/locale/generic/time_members.h: Same.
* config/locale/gnu/messages_members.h: Same.
* config/locale/gnu/time_members.h: Same.
2003-10-02 Paolo Carlini <pcarlini@unitus.it>
PR libstdc++/12232

View File

@ -38,7 +38,7 @@
__timepunct<_CharT>::__timepunct(size_t __refs)
: facet(__refs), _M_data(NULL)
{
_M_name_timepunct = _S_c_name;
_M_name_timepunct = _S_get_c_name();
_M_initialize_timepunct();
}
@ -46,7 +46,7 @@
__timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
: facet(__refs), _M_data(__cache)
{
_M_name_timepunct = _S_c_name;
_M_name_timepunct = _S_get_c_name();
_M_initialize_timepunct();
}
@ -64,7 +64,7 @@
template<typename _CharT>
__timepunct<_CharT>::~__timepunct()
{
if (_S_c_name != _M_name_timepunct)
if (_M_name_timepunct != _S_get_c_name())
delete [] _M_name_timepunct;
delete _M_data;
_S_destroy_c_locale(_M_c_locale_timepunct);

View File

@ -39,7 +39,7 @@
: facet(__refs)
{
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
_M_name_messages = _S_c_name;
_M_name_messages = _S_get_c_name();
#endif
_M_c_locale_messages = _S_get_c_locale();
}
@ -72,7 +72,7 @@
messages<_CharT>::~messages()
{
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
if (_S_c_name != _M_name_messages)
if (_M_name_messages != _S_get_c_name())
delete [] _M_name_messages;
#endif
_S_destroy_c_locale(_M_c_locale_messages);
@ -100,7 +100,7 @@
: messages<_CharT>(__refs)
{
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
if (this->_S_c_name != this->_M_name_messages)
if (this->_M_name_messages != locale::facet::_S_get_c_name())
delete [] this->_M_name_messages;
char* __tmp = new char[std::strlen(__s) + 1];
std::strcpy(__tmp, __s);

View File

@ -39,7 +39,7 @@
: facet(__refs), _M_data(NULL)
{
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
_M_name_timepunct = _S_c_name;
_M_name_timepunct = _S_get_c_name();
#endif
_M_initialize_timepunct();
}
@ -49,7 +49,7 @@
: facet(__refs), _M_data(__cache)
{
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
_M_name_timepunct = _S_c_name;
_M_name_timepunct = _S_get_c_name();
#endif
_M_initialize_timepunct();
}
@ -72,7 +72,7 @@
__timepunct<_CharT>::~__timepunct()
{
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
if (_S_c_name != _M_name_timepunct)
if (_M_name_timepunct != _S_get_c_name())
delete [] _M_name_timepunct;
#endif
delete _M_data;

View File

@ -224,10 +224,14 @@ namespace std
static void
_S_destroy_c_locale(__c_locale& __cloc);
// Returns data from the underlying "C" library for the classic locale.
// Returns data from the underlying "C" library data for the
// classic locale.
static __c_locale
_S_get_c_locale();
static const char*
_S_get_c_name();
private:
inline void
_M_add_reference() const throw()

View File

@ -486,6 +486,10 @@ namespace std
return _S_c_locale;
}
const char*
locale::facet::_S_get_c_name()
{ return _S_c_name; }
// Definitions for static const data members of time_base.
template<>
const char*

View File

@ -258,7 +258,7 @@ namespace std
for (size_t __i = 0; __i < _S_categories_size; ++__i)
{
_M_names[__i] = new (&name_c[__i]) char[2];
std::strcpy(_M_names[__i], locale::facet::_S_c_name);
std::strcpy(_M_names[__i], locale::facet::_S_get_c_name());
}
// This is needed as presently the C++ version of "C" locales