Commit fea4065d by Benjamin Kosnik Committed by Benjamin Kosnik

linker-map.gnu: Add __moneypunct_cache, __timepunct_cache.


2003-07-17  Benjamin Kosnik  <bkoz@redhat.com>

	* config/linker-map.gnu: Add __moneypunct_cache, __timepunct_cache.
	* config/locale/generic/messages_members.h: Tweaks.
	* config/locale/generic/monetary_members.cc
	(moneypunct::_M_initialize_moneypunct): Use cache.
	(moneypunct::~moneypunct): Delete cache.
	* config/locale/generic/time_members.cc:
	(__timepunct::_M_initialize_timepunct): Use cache.
	* config/locale/generic/time_members.h:
	(__timepunct::~__timepunct): Delete cache.
	(__timepunct::__timepunct): Set cache.
	* config/locale/gnu/messages_members.h: Tweaks.
	* config/locale/gnu/monetary_members.cc:
	(moneypunct::_M_initialize_moneypunct): Use cache.
	(moneypunct::~moneypunct): Delete cache.
	* config/locale/gnu/time_members.cc:
	(__timepunct::_M_initialize_timepunct): Use cache.
	* config/locale/gnu/time_members.h:
	(__timepunct::~__timepunct): Delete cache.
	(__timepunct::__timepunct): Set cache.
	* include/bits/locale_facets.h (__timepunct_cache): New.
	(__moneypunct_cache): New.
	* include/bits/locale_facets.tcc: Tweak.
	* src/locale.cc (__timepunct::_S_timezones): Adjust for cache.
	* src/locale-inst.cc: Instantiate caches.
	* src/globals.cc: Add "C" caches.
	* src/localename.cc: Use external "C" caches.

From-SVN: r69535
parent c715abdd
2003-07-17 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Add __moneypunct_cache, __timepunct_cache.
* config/locale/generic/messages_members.h: Tweaks.
* config/locale/generic/monetary_members.cc
(moneypunct::_M_initialize_moneypunct): Use cache.
(moneypunct::~moneypunct): Delete cache.
* config/locale/generic/time_members.cc:
(__timepunct::_M_initialize_timepunct): Use cache.
* config/locale/generic/time_members.h:
(__timepunct::~__timepunct): Delete cache.
(__timepunct::__timepunct): Set cache.
* config/locale/gnu/messages_members.h: Tweaks.
* config/locale/gnu/monetary_members.cc:
(moneypunct::_M_initialize_moneypunct): Use cache.
(moneypunct::~moneypunct): Delete cache.
* config/locale/gnu/time_members.cc:
(__timepunct::_M_initialize_timepunct): Use cache.
* config/locale/gnu/time_members.h:
(__timepunct::~__timepunct): Delete cache.
(__timepunct::__timepunct): Set cache.
* include/bits/locale_facets.h (__timepunct_cache): New.
(__moneypunct_cache): New.
* include/bits/locale_facets.tcc: Tweak.
* src/locale.cc (__timepunct::_S_timezones): Adjust for cache.
* src/locale-inst.cc: Instantiate caches.
* src/globals.cc: Add "C" caches.
* src/localename.cc: Use external "C" caches.
2003-07-17 Phil Edwards <pme@gcc.gnu.org> 2003-07-17 Phil Edwards <pme@gcc.gnu.org>
* docs/doxygen/guide.html: Fix typo. * docs/doxygen/guide.html: Fix typo.
......
...@@ -55,7 +55,9 @@ GLIBCXX_3.4 { ...@@ -55,7 +55,9 @@ GLIBCXX_3.4 {
std::__num_base::_S_format_int*; std::__num_base::_S_format_int*;
std::__num_base::_S_atoms_in; std::__num_base::_S_atoms_in;
std::__num_base::_S_atoms_out; std::__num_base::_S_atoms_out;
std::__numpunct_cache* std::__moneypunct_cache*;
std::__numpunct_cache*;
std::__timepunct_cache*
}; };
# Names not in an 'extern' block are mangled names. # Names not in an 'extern' block are mangled names.
......
...@@ -36,12 +36,12 @@ ...@@ -36,12 +36,12 @@
// Non-virtual member functions. // Non-virtual member functions.
template<typename _CharT> template<typename _CharT>
messages<_CharT>::messages(size_t __refs) messages<_CharT>::messages(size_t __refs)
: locale::facet(__refs) : facet(__refs)
{ _M_c_locale_messages = _S_c_locale; } { _M_c_locale_messages = _S_c_locale; }
template<typename _CharT> template<typename _CharT>
messages<_CharT>::messages(__c_locale, const char*, size_t __refs) messages<_CharT>::messages(__c_locale, const char*, size_t __refs)
: locale::facet(__refs) : facet(__refs)
{ _M_c_locale_messages = _S_c_locale; } { _M_c_locale_messages = _S_c_locale; }
template<typename _CharT> template<typename _CharT>
......
// std::moneypunct implementation details, generic version -*- C++ -*- // std::moneypunct implementation details, generic version -*- C++ -*-
// Copyright (C) 2001, 2002 Free Software Foundation, Inc. // Copyright (C) 2001, 2002, 2003 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
...@@ -47,41 +47,47 @@ namespace std ...@@ -47,41 +47,47 @@ namespace std
void void
moneypunct<char, true>::_M_initialize_moneypunct(__c_locale, const char*) moneypunct<char, true>::_M_initialize_moneypunct(__c_locale, const char*)
{ {
// "C" locale // "C" locale.
_M_decimal_point = '.'; if (!_M_data)
_M_thousands_sep = ','; _M_data = new __moneypunct_cache<char>;
_M_grouping = "";
_M_curr_symbol = ""; _M_data->_M_decimal_point = '.';
_M_positive_sign = ""; _M_data->_M_thousands_sep = ',';
_M_negative_sign = ""; _M_data->_M_grouping = "";
_M_frac_digits = 0; _M_data->_M_curr_symbol = "";
_M_pos_format = money_base::_S_default_pattern; _M_data->_M_positive_sign = "";
_M_neg_format = money_base::_S_default_pattern; _M_data->_M_negative_sign = "";
_M_data->_M_frac_digits = 0;
_M_data->_M_pos_format = money_base::_S_default_pattern;
_M_data->_M_neg_format = money_base::_S_default_pattern;
} }
template<> template<>
void void
moneypunct<char, false>::_M_initialize_moneypunct(__c_locale, const char*) moneypunct<char, false>::_M_initialize_moneypunct(__c_locale, const char*)
{ {
// "C" locale // "C" locale.
_M_decimal_point = '.'; if (!_M_data)
_M_thousands_sep = ','; _M_data = new __moneypunct_cache<char>;
_M_grouping = "";
_M_curr_symbol = ""; _M_data->_M_decimal_point = '.';
_M_positive_sign = ""; _M_data->_M_thousands_sep = ',';
_M_negative_sign = ""; _M_data->_M_grouping = "";
_M_frac_digits = 0; _M_data->_M_curr_symbol = "";
_M_pos_format = money_base::_S_default_pattern; _M_data->_M_positive_sign = "";
_M_neg_format = money_base::_S_default_pattern; _M_data->_M_negative_sign = "";
_M_data->_M_frac_digits = 0;
_M_data->_M_pos_format = money_base::_S_default_pattern;
_M_data->_M_neg_format = money_base::_S_default_pattern;
} }
template<> template<>
moneypunct<char, true>::~moneypunct() moneypunct<char, true>::~moneypunct()
{ } { delete _M_data; }
template<> template<>
moneypunct<char, false>::~moneypunct() moneypunct<char, false>::~moneypunct()
{ } { delete _M_data; }
#ifdef _GLIBCXX_USE_WCHAR_T #ifdef _GLIBCXX_USE_WCHAR_T
template<> template<>
...@@ -90,15 +96,18 @@ namespace std ...@@ -90,15 +96,18 @@ namespace std
const char*) const char*)
{ {
// "C" locale // "C" locale
_M_decimal_point = L'.'; if (!_M_data)
_M_thousands_sep = L','; _M_data = new __moneypunct_cache<wchar_t>;
_M_grouping = "";
_M_curr_symbol = L""; _M_data->_M_decimal_point = L'.';
_M_positive_sign = L""; _M_data->_M_thousands_sep = L',';
_M_negative_sign = L""; _M_data->_M_grouping = "";
_M_frac_digits = 0; _M_data->_M_curr_symbol = L"";
_M_pos_format = money_base::_S_default_pattern; _M_data->_M_positive_sign = L"";
_M_neg_format = money_base::_S_default_pattern; _M_data->_M_negative_sign = L"";
_M_data->_M_frac_digits = 0;
_M_data->_M_pos_format = money_base::_S_default_pattern;
_M_data->_M_neg_format = money_base::_S_default_pattern;
} }
template<> template<>
...@@ -107,23 +116,26 @@ namespace std ...@@ -107,23 +116,26 @@ namespace std
const char*) const char*)
{ {
// "C" locale // "C" locale
_M_decimal_point = L'.'; if (!_M_data)
_M_thousands_sep = L','; _M_data = new __moneypunct_cache<wchar_t>;
_M_grouping = "";
_M_curr_symbol = L""; _M_data->_M_decimal_point = L'.';
_M_positive_sign = L""; _M_data->_M_thousands_sep = L',';
_M_negative_sign = L""; _M_data->_M_grouping = "";
_M_frac_digits = 0; _M_data->_M_curr_symbol = L"";
_M_pos_format = money_base::_S_default_pattern; _M_data->_M_positive_sign = L"";
_M_neg_format = money_base::_S_default_pattern; _M_data->_M_negative_sign = L"";
_M_data->_M_frac_digits = 0;
_M_data->_M_pos_format = money_base::_S_default_pattern;
_M_data->_M_neg_format = money_base::_S_default_pattern;
} }
template<> template<>
moneypunct<wchar_t, true>::~moneypunct() moneypunct<wchar_t, true>::~moneypunct()
{ } { delete _M_data; }
template<> template<>
moneypunct<wchar_t, false>::~moneypunct() moneypunct<wchar_t, false>::~moneypunct()
{ } { delete _M_data; }
#endif #endif
} }
// std::time_get, std::time_put implementation, generic version -*- C++ -*- // std::time_get, std::time_put implementation, generic version -*- C++ -*-
// Copyright (C) 2001, 2002 Free Software Foundation, Inc. // Copyright (C) 2001, 2002, 2003 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
...@@ -55,62 +55,65 @@ namespace std ...@@ -55,62 +55,65 @@ namespace std
void void
__timepunct<char>::_M_initialize_timepunct(__c_locale) __timepunct<char>::_M_initialize_timepunct(__c_locale)
{ {
// "C" locale // "C" locale.
_M_date_format = "%m/%d/%y"; if (!_M_data)
_M_date_era_format = "%m/%d/%y"; _M_data = new __timepunct_cache<char>;
_M_time_format = "%H:%M:%S";
_M_time_era_format = "%H:%M:%S"; _M_data->_M_date_format = "%m/%d/%y";
_M_date_time_format = ""; _M_data->_M_date_era_format = "%m/%d/%y";
_M_date_time_era_format = ""; _M_data->_M_time_format = "%H:%M:%S";
_M_am = "AM"; _M_data->_M_time_era_format = "%H:%M:%S";
_M_pm = "PM"; _M_data->_M_date_time_format = "";
_M_am_pm_format = ""; _M_data->_M_date_time_era_format = "";
_M_data->_M_am = "AM";
_M_data->_M_pm = "PM";
_M_data->_M_am_pm_format = "";
// Day names, starting with "C"'s Sunday. // Day names, starting with "C"'s Sunday.
_M_day1 = "Sunday"; _M_data->_M_day1 = "Sunday";
_M_day2 = "Monday"; _M_data->_M_day2 = "Monday";
_M_day3 = "Tuesday"; _M_data->_M_day3 = "Tuesday";
_M_day4 = "Wednesday"; _M_data->_M_day4 = "Wednesday";
_M_day5 = "Thursday"; _M_data->_M_day5 = "Thursday";
_M_day6 = "Friday"; _M_data->_M_day6 = "Friday";
_M_day7 = "Saturday"; _M_data->_M_day7 = "Saturday";
// Abbreviated day names, starting with "C"'s Sun. // Abbreviated day names, starting with "C"'s Sun.
_M_day_a1 = "Sun"; _M_data->_M_aday1 = "Sun";
_M_day_a2 = "Mon"; _M_data->_M_aday2 = "Mon";
_M_day_a3 = "Tue"; _M_data->_M_aday3 = "Tue";
_M_day_a4 = "Wed"; _M_data->_M_aday4 = "Wed";
_M_day_a5 = "Thu"; _M_data->_M_aday5 = "Thu";
_M_day_a6 = "Fri"; _M_data->_M_aday6 = "Fri";
_M_day_a7 = "Sat"; _M_data->_M_aday7 = "Sat";
// Month names, starting with "C"'s January. // Month names, starting with "C"'s January.
_M_month01 = "January"; _M_data->_M_month01 = "January";
_M_month02 = "February"; _M_data->_M_month02 = "February";
_M_month03 = "March"; _M_data->_M_month03 = "March";
_M_month04 = "April"; _M_data->_M_month04 = "April";
_M_month05 = "May"; _M_data->_M_month05 = "May";
_M_month06 = "June"; _M_data->_M_month06 = "June";
_M_month07 = "July"; _M_data->_M_month07 = "July";
_M_month08 = "August"; _M_data->_M_month08 = "August";
_M_month09 = "September"; _M_data->_M_month09 = "September";
_M_month10 = "October"; _M_data->_M_month10 = "October";
_M_month11 = "November"; _M_data->_M_month11 = "November";
_M_month12 = "December"; _M_data->_M_month12 = "December";
// Abbreviated month names, starting with "C"'s Jan. // Abbreviated month names, starting with "C"'s Jan.
_M_month_a01 = "Jan"; _M_data->_M_amonth01 = "Jan";
_M_month_a02 = "Feb"; _M_data->_M_amonth02 = "Feb";
_M_month_a03 = "Mar"; _M_data->_M_amonth03 = "Mar";
_M_month_a04 = "Apr"; _M_data->_M_amonth04 = "Apr";
_M_month_a05 = "May"; _M_data->_M_amonth05 = "May";
_M_month_a06 = "Jun"; _M_data->_M_amonth06 = "Jun";
_M_month_a07 = "July"; _M_data->_M_amonth07 = "July";
_M_month_a08 = "Aug"; _M_data->_M_amonth08 = "Aug";
_M_month_a09 = "Sep"; _M_data->_M_amonth09 = "Sep";
_M_month_a10 = "Oct"; _M_data->_M_amonth10 = "Oct";
_M_month_a11 = "Nov"; _M_data->_M_amonth11 = "Nov";
_M_month_a12 = "Dec"; _M_data->_M_amonth12 = "Dec";
} }
#ifdef _GLIBCXX_USE_WCHAR_T #ifdef _GLIBCXX_USE_WCHAR_T
...@@ -131,62 +134,65 @@ namespace std ...@@ -131,62 +134,65 @@ namespace std
void void
__timepunct<wchar_t>::_M_initialize_timepunct(__c_locale) __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale)
{ {
// "C" locale // "C" locale.
_M_date_format = L"%m/%d/%y"; if (!_M_data)
_M_date_era_format = L"%m/%d/%y"; _M_data = new __timepunct_cache<wchar_t>;
_M_time_format = L"%H:%M:%S";
_M_time_era_format = L"%H:%M:%S"; _M_data->_M_date_format = L"%m/%d/%y";
_M_date_time_format = L""; _M_data->_M_date_era_format = L"%m/%d/%y";
_M_date_time_era_format = L""; _M_data->_M_time_format = L"%H:%M:%S";
_M_am = L"AM"; _M_data->_M_time_era_format = L"%H:%M:%S";
_M_pm = L"PM"; _M_data->_M_date_time_format = L"";
_M_am_pm_format = L""; _M_data->_M_date_time_era_format = L"";
_M_data->_M_am = L"AM";
_M_data->_M_pm = L"PM";
_M_data->_M_am_pm_format = L"";
// Day names, starting with "C"'s Sunday. // Day names, starting with "C"'s Sunday.
_M_day1 = L"Sunday"; _M_data->_M_day1 = L"Sunday";
_M_day2 = L"Monday"; _M_data->_M_day2 = L"Monday";
_M_day3 = L"Tuesday"; _M_data->_M_day3 = L"Tuesday";
_M_day4 = L"Wednesday"; _M_data->_M_day4 = L"Wednesday";
_M_day5 = L"Thursday"; _M_data->_M_day5 = L"Thursday";
_M_day6 = L"Friday"; _M_data->_M_day6 = L"Friday";
_M_day7 = L"Saturday"; _M_data->_M_day7 = L"Saturday";
// Abbreviated day names, starting with "C"'s Sun. // Abbreviated day names, starting with "C"'s Sun.
_M_day_a1 = L"Sun"; _M_data->_M_aday1 = L"Sun";
_M_day_a2 = L"Mon"; _M_data->_M_aday2 = L"Mon";
_M_day_a3 = L"Tue"; _M_data->_M_aday3 = L"Tue";
_M_day_a4 = L"Wed"; _M_data->_M_aday4 = L"Wed";
_M_day_a5 = L"Thu"; _M_data->_M_aday5 = L"Thu";
_M_day_a6 = L"Fri"; _M_data->_M_aday6 = L"Fri";
_M_day_a7 = L"Sat"; _M_data->_M_aday7 = L"Sat";
// Month names, starting with "C"'s January. // Month names, starting with "C"'s January.
_M_month01 = L"January"; _M_data->_M_month01 = L"January";
_M_month02 = L"February"; _M_data->_M_month02 = L"February";
_M_month03 = L"March"; _M_data->_M_month03 = L"March";
_M_month04 = L"April"; _M_data->_M_month04 = L"April";
_M_month05 = L"May"; _M_data->_M_month05 = L"May";
_M_month06 = L"June"; _M_data->_M_month06 = L"June";
_M_month07 = L"July"; _M_data->_M_month07 = L"July";
_M_month08 = L"August"; _M_data->_M_month08 = L"August";
_M_month09 = L"September"; _M_data->_M_month09 = L"September";
_M_month10 = L"October"; _M_data->_M_month10 = L"October";
_M_month11 = L"November"; _M_data->_M_month11 = L"November";
_M_month12 = L"December"; _M_data->_M_month12 = L"December";
// Abbreviated month names, starting with "C"'s Jan. // Abbreviated month names, starting with "C"'s Jan.
_M_month_a01 = L"Jan"; _M_data->_M_amonth01 = L"Jan";
_M_month_a02 = L"Feb"; _M_data->_M_amonth02 = L"Feb";
_M_month_a03 = L"Mar"; _M_data->_M_amonth03 = L"Mar";
_M_month_a04 = L"Apr"; _M_data->_M_amonth04 = L"Apr";
_M_month_a05 = L"May"; _M_data->_M_amonth05 = L"May";
_M_month_a06 = L"Jun"; _M_data->_M_amonth06 = L"Jun";
_M_month_a07 = L"July"; _M_data->_M_amonth07 = L"July";
_M_month_a08 = L"Aug"; _M_data->_M_amonth08 = L"Aug";
_M_month_a09 = L"Sep"; _M_data->_M_amonth09 = L"Sep";
_M_month_a10 = L"Oct"; _M_data->_M_amonth10 = L"Oct";
_M_month_a11 = L"Nov"; _M_data->_M_amonth11 = L"Nov";
_M_month_a12 = L"Dec"; _M_data->_M_amonth12 = L"Dec";
} }
#endif #endif
} }
...@@ -36,7 +36,15 @@ ...@@ -36,7 +36,15 @@
template<typename _CharT> template<typename _CharT>
__timepunct<_CharT>::__timepunct(size_t __refs) __timepunct<_CharT>::__timepunct(size_t __refs)
: locale::facet(__refs) : facet(__refs), _M_data(NULL)
{
_M_name_timepunct = _S_c_name;
_M_initialize_timepunct();
}
template<typename _CharT>
__timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
: facet(__refs), _M_data(__cache)
{ {
_M_name_timepunct = _S_c_name; _M_name_timepunct = _S_c_name;
_M_initialize_timepunct(); _M_initialize_timepunct();
...@@ -45,7 +53,7 @@ ...@@ -45,7 +53,7 @@
template<typename _CharT> template<typename _CharT>
__timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s, __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
size_t __refs) size_t __refs)
: locale::facet(__refs) : facet(__refs), _M_data(NULL)
{ {
_M_name_timepunct = new char[strlen(__s) + 1]; _M_name_timepunct = new char[strlen(__s) + 1];
strcpy(_M_name_timepunct, __s); strcpy(_M_name_timepunct, __s);
...@@ -57,5 +65,6 @@ ...@@ -57,5 +65,6 @@
{ {
if (_S_c_name != _M_name_timepunct) if (_S_c_name != _M_name_timepunct)
delete [] _M_name_timepunct; delete [] _M_name_timepunct;
delete _M_data;
_S_destroy_c_locale(_M_c_locale_timepunct); _S_destroy_c_locale(_M_c_locale_timepunct);
} }
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
// Non-virtual member functions. // Non-virtual member functions.
template<typename _CharT> template<typename _CharT>
messages<_CharT>::messages(size_t __refs) messages<_CharT>::messages(size_t __refs)
: locale::facet(__refs) : facet(__refs)
{ {
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)) #if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
_M_name_messages = _S_c_name; _M_name_messages = _S_c_name;
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
messages<_CharT>::messages(__c_locale __cloc, messages<_CharT>::messages(__c_locale __cloc,
const char* __s __attribute__ ((__unused__)), const char* __s __attribute__ ((__unused__)),
size_t __refs) size_t __refs)
: locale::facet(__refs) : facet(__refs)
{ {
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)) #if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
_M_name_messages = new char[strlen(__s) + 1]; _M_name_messages = new char[strlen(__s) + 1];
......
...@@ -36,7 +36,17 @@ ...@@ -36,7 +36,17 @@
template<typename _CharT> template<typename _CharT>
__timepunct<_CharT>::__timepunct(size_t __refs) __timepunct<_CharT>::__timepunct(size_t __refs)
: locale::facet(__refs) : facet(__refs), _M_data(NULL)
{
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
_M_name_timepunct = _S_c_name;
#endif
_M_initialize_timepunct();
}
template<typename _CharT>
__timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
: facet(__refs), _M_data(__cache)
{ {
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)) #if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
_M_name_timepunct = _S_c_name; _M_name_timepunct = _S_c_name;
...@@ -48,7 +58,7 @@ ...@@ -48,7 +58,7 @@
__timepunct<_CharT>::__timepunct(__c_locale __cloc, __timepunct<_CharT>::__timepunct(__c_locale __cloc,
const char* __s __attribute__ ((__unused__)), const char* __s __attribute__ ((__unused__)),
size_t __refs) size_t __refs)
: locale::facet(__refs) : facet(__refs), _M_data(NULL)
{ {
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)) #if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2))
_M_name_timepunct = new char[strlen(__s) + 1]; _M_name_timepunct = new char[strlen(__s) + 1];
...@@ -64,5 +74,6 @@ ...@@ -64,5 +74,6 @@
if (_S_c_name != _M_name_timepunct) if (_S_c_name != _M_name_timepunct)
delete [] _M_name_timepunct; delete [] _M_name_timepunct;
#endif #endif
delete _M_data;
_S_destroy_c_locale(_M_c_locale_timepunct); _S_destroy_c_locale(_M_c_locale_timepunct);
} }
...@@ -1701,7 +1701,7 @@ namespace std ...@@ -1701,7 +1701,7 @@ namespace std
{ {
int __tmp; int __tmp;
_M_extract_name(__beg, __end, __tmp, _M_extract_name(__beg, __end, __tmp,
__timepunct<_CharT>::_S_timezones, __timepunct_cache<_CharT>::_S_timezones,
14, __err); 14, __err);
// GMT requires special effort. // GMT requires special effort.
......
...@@ -157,8 +157,8 @@ namespace __gnu_cxx ...@@ -157,8 +157,8 @@ namespace __gnu_cxx
typedef char fake_moneypunct_c[sizeof(moneypunct<char, true>)] typedef char fake_moneypunct_c[sizeof(moneypunct<char, true>)]
__attribute__ ((aligned(__alignof__(moneypunct<char, true>)))); __attribute__ ((aligned(__alignof__(moneypunct<char, true>))));
fake_moneypunct_c moneypunct_tc; fake_moneypunct_c moneypunct_ct;
fake_moneypunct_c moneypunct_fc; fake_moneypunct_c moneypunct_cf;
typedef char fake_money_get_c[sizeof(money_get<char>)] typedef char fake_money_get_c[sizeof(money_get<char>)]
__attribute__ ((aligned(__alignof__(money_get<char>)))); __attribute__ ((aligned(__alignof__(money_get<char>))));
...@@ -211,8 +211,8 @@ namespace __gnu_cxx ...@@ -211,8 +211,8 @@ namespace __gnu_cxx
typedef char fake_moneypunct_w[sizeof(moneypunct<wchar_t, true>)] typedef char fake_moneypunct_w[sizeof(moneypunct<wchar_t, true>)]
__attribute__ ((aligned(__alignof__(moneypunct<wchar_t, true>)))); __attribute__ ((aligned(__alignof__(moneypunct<wchar_t, true>))));
fake_moneypunct_w moneypunct_tw; fake_moneypunct_w moneypunct_wt;
fake_moneypunct_w moneypunct_fw; fake_moneypunct_w moneypunct_wf;
typedef char fake_money_get_w[sizeof(money_get<wchar_t>)] typedef char fake_money_get_w[sizeof(money_get<wchar_t>)]
__attribute__ ((aligned(__alignof__(money_get<wchar_t>)))); __attribute__ ((aligned(__alignof__(money_get<wchar_t>))));
...@@ -239,15 +239,33 @@ namespace __gnu_cxx ...@@ -239,15 +239,33 @@ namespace __gnu_cxx
fake_messages_w messages_w; fake_messages_w messages_w;
#endif #endif
// Storage for C locale caches // Storage for "C" locale caches.
typedef char fake_locale_cache_c[sizeof(std::__numpunct_cache<char>)] typedef char fake_num_cache_c[sizeof(std::__numpunct_cache<char>)]
__attribute__ ((aligned(__alignof__(std::__numpunct_cache<char>)))); __attribute__ ((aligned(__alignof__(std::__numpunct_cache<char>))));
fake_locale_cache_c numpunct_cache_c; fake_num_cache_c numpunct_cache_c;
typedef char fake_money_cache_c[sizeof(std::__moneypunct_cache<char>)]
__attribute__ ((aligned(__alignof__(std::__moneypunct_cache<char>))));
fake_money_cache_c moneypunct_cache_ct;
fake_money_cache_c moneypunct_cache_cf;
typedef char fake_time_cache_c[sizeof(std::__timepunct_cache<char>)]
__attribute__ ((aligned(__alignof__(std::__timepunct_cache<char>))));
fake_time_cache_c timepunct_cache_c;
#ifdef _GLIBCXX_USE_WCHAR_T #ifdef _GLIBCXX_USE_WCHAR_T
typedef char fake_locale_cache_w[sizeof(std::__numpunct_cache<wchar_t>)] typedef char fake_num_cache_w[sizeof(std::__numpunct_cache<wchar_t>)]
__attribute__ ((aligned(__alignof__(std::__numpunct_cache<wchar_t>)))); __attribute__ ((aligned(__alignof__(std::__numpunct_cache<wchar_t>))));
fake_locale_cache_w numpunct_cache_w; fake_num_cache_w numpunct_cache_w;
typedef char fake_money_cache_w[sizeof(std::__moneypunct_cache<wchar_t>)]
__attribute__ ((aligned(__alignof__(std::__moneypunct_cache<wchar_t>))));
fake_money_cache_w moneypunct_cache_wt;
fake_money_cache_w moneypunct_cache_wf;
typedef char fake_time_cache_w[sizeof(std::__timepunct_cache<wchar_t>)]
__attribute__ ((aligned(__alignof__(std::__timepunct_cache<wchar_t>))));
fake_time_cache_w timepunct_cache_w;
#endif #endif
// Globals for once-only runtime initialization of mutex objects. This // Globals for once-only runtime initialization of mutex objects. This
......
...@@ -41,6 +41,7 @@ namespace std ...@@ -41,6 +41,7 @@ namespace std
// moneypunct, money_get, and money_put // moneypunct, money_get, and money_put
template class moneypunct<char, false>; template class moneypunct<char, false>;
template class moneypunct<char, true>; template class moneypunct<char, true>;
template struct __moneypunct_cache<char>;
template class moneypunct_byname<char, false>; template class moneypunct_byname<char, false>;
template class moneypunct_byname<char, true>; template class moneypunct_byname<char, true>;
template class money_get<char, istreambuf_iterator<char> >; template class money_get<char, istreambuf_iterator<char> >;
...@@ -49,6 +50,7 @@ namespace std ...@@ -49,6 +50,7 @@ namespace std
#ifdef _GLIBCXX_USE_WCHAR_T #ifdef _GLIBCXX_USE_WCHAR_T
template class moneypunct<wchar_t, false>; template class moneypunct<wchar_t, false>;
template class moneypunct<wchar_t, true>; template class moneypunct<wchar_t, true>;
template struct __moneypunct_cache<wchar_t>;
template class moneypunct_byname<wchar_t, false>; template class moneypunct_byname<wchar_t, false>;
template class moneypunct_byname<wchar_t, true>; template class moneypunct_byname<wchar_t, true>;
template class money_get<wchar_t, istreambuf_iterator<wchar_t> >; template class money_get<wchar_t, istreambuf_iterator<wchar_t> >;
...@@ -147,6 +149,7 @@ namespace std ...@@ -147,6 +149,7 @@ namespace std
// time_get and time_put // time_get and time_put
template class __timepunct<char>; template class __timepunct<char>;
template struct __timepunct_cache<char>;
template class time_put<char, ostreambuf_iterator<char> >; template class time_put<char, ostreambuf_iterator<char> >;
template class time_put_byname<char, ostreambuf_iterator<char> >; template class time_put_byname<char, ostreambuf_iterator<char> >;
template class time_get<char, istreambuf_iterator<char> >; template class time_get<char, istreambuf_iterator<char> >;
...@@ -154,6 +157,7 @@ namespace std ...@@ -154,6 +157,7 @@ namespace std
#ifdef _GLIBCXX_USE_WCHAR_T #ifdef _GLIBCXX_USE_WCHAR_T
template class __timepunct<wchar_t>; template class __timepunct<wchar_t>;
template struct __timepunct_cache<wchar_t>;
template class time_put<wchar_t, ostreambuf_iterator<wchar_t> >; template class time_put<wchar_t, ostreambuf_iterator<wchar_t> >;
template class time_put_byname<wchar_t, ostreambuf_iterator<wchar_t> >; template class time_put_byname<wchar_t, ostreambuf_iterator<wchar_t> >;
template class time_get<wchar_t, istreambuf_iterator<wchar_t> >; template class time_get<wchar_t, istreambuf_iterator<wchar_t> >;
......
...@@ -455,7 +455,7 @@ namespace std ...@@ -455,7 +455,7 @@ namespace std
// Definitions for static const data members of time_base. // Definitions for static const data members of time_base.
template<> template<>
const char* const char*
__timepunct<char>::_S_timezones[14] = __timepunct_cache<char>::_S_timezones[14] =
{ {
"GMT", "HST", "AKST", "PST", "MST", "CST", "EST", "AST", "NST", "CET", "GMT", "HST", "AKST", "PST", "MST", "CST", "EST", "AST", "NST", "CET",
"IST", "EET", "CST", "JST" "IST", "EET", "CST", "JST"
...@@ -464,7 +464,7 @@ namespace std ...@@ -464,7 +464,7 @@ namespace std
#ifdef _GLIBCXX_USE_WCHAR_T #ifdef _GLIBCXX_USE_WCHAR_T
template<> template<>
const wchar_t* const wchar_t*
__timepunct<wchar_t>::_S_timezones[14] = __timepunct_cache<wchar_t>::_S_timezones[14] =
{ {
L"GMT", L"HST", L"AKST", L"PST", L"MST", L"CST", L"EST", L"AST", L"GMT", L"HST", L"AKST", L"PST", L"MST", L"CST", L"EST", L"AST",
L"NST", L"CET", L"IST", L"EET", L"CST", L"JST" L"NST", L"CET", L"IST", L"EET", L"CST", L"JST"
......
...@@ -43,10 +43,10 @@ namespace __gnu_cxx ...@@ -43,10 +43,10 @@ namespace __gnu_cxx
extern std::collate<char> collate_c; extern std::collate<char> collate_c;
extern numpunct<char> numpunct_c; extern numpunct<char> numpunct_c;
extern num_get<char> num_get_c; extern num_get<char> num_get_c;
extern num_put<char> num_put_c; extern num_put<char> num_put_c;
extern codecvt<char, char, mbstate_t> codecvt_c; extern codecvt<char, char, mbstate_t> codecvt_c;
extern moneypunct<char, false> moneypunct_fc; extern moneypunct<char, false> moneypunct_cf;
extern moneypunct<char, true> moneypunct_tc; extern moneypunct<char, true> moneypunct_ct;
extern money_get<char> money_get_c; extern money_get<char> money_get_c;
extern money_put<char> money_put_c; extern money_put<char> money_put_c;
extern __timepunct<char> timepunct_c; extern __timepunct<char> timepunct_c;
...@@ -60,8 +60,8 @@ namespace __gnu_cxx ...@@ -60,8 +60,8 @@ namespace __gnu_cxx
extern num_get<wchar_t> num_get_w; extern num_get<wchar_t> num_get_w;
extern num_put<wchar_t> num_put_w; extern num_put<wchar_t> num_put_w;
extern codecvt<wchar_t, char, mbstate_t> codecvt_w; extern codecvt<wchar_t, char, mbstate_t> codecvt_w;
extern moneypunct<wchar_t, false> moneypunct_fw; extern moneypunct<wchar_t, false> moneypunct_wf;
extern moneypunct<wchar_t, true> moneypunct_tw; extern moneypunct<wchar_t, true> moneypunct_wt;
extern money_get<wchar_t> money_get_w; extern money_get<wchar_t> money_get_w;
extern money_put<wchar_t> money_put_w; extern money_put<wchar_t> money_put_w;
extern __timepunct<wchar_t> timepunct_w; extern __timepunct<wchar_t> timepunct_w;
...@@ -70,10 +70,17 @@ namespace __gnu_cxx ...@@ -70,10 +70,17 @@ namespace __gnu_cxx
extern std::messages<wchar_t> messages_w; extern std::messages<wchar_t> messages_w;
#endif #endif
// And the caches....
extern locale::facet* cache_vec[_GLIBCXX_NUM_FACETS]; extern locale::facet* cache_vec[_GLIBCXX_NUM_FACETS];
extern std::__numpunct_cache<char> numpunct_cache_c; extern __numpunct_cache<char> numpunct_cache_c;
extern __moneypunct_cache<char> moneypunct_cache_cf;
extern __moneypunct_cache<char> moneypunct_cache_ct;
extern __timepunct_cache<char> timepunct_cache_c;
#ifdef _GLIBCXX_USE_WCHAR_T #ifdef _GLIBCXX_USE_WCHAR_T
extern std::__numpunct_cache<wchar_t> numpunct_cache_w; extern __numpunct_cache<wchar_t> numpunct_cache_w;
extern __moneypunct_cache<wchar_t> moneypunct_cache_wf;
extern __moneypunct_cache<wchar_t> moneypunct_cache_wt;
extern __timepunct_cache<wchar_t> timepunct_cache_w;
#endif #endif
} // namespace __gnu_cxx } // namespace __gnu_cxx
...@@ -296,7 +303,6 @@ namespace std ...@@ -296,7 +303,6 @@ namespace std
_M_init_facet(new (&ctype_c) std::ctype<char>(0, false, 1)); _M_init_facet(new (&ctype_c) std::ctype<char>(0, false, 1));
_M_init_facet(new (&codecvt_c) codecvt<char, char, mbstate_t>(1)); _M_init_facet(new (&codecvt_c) codecvt<char, char, mbstate_t>(1));
// Safe to cache this.
typedef __numpunct_cache<char> num_cache_c; typedef __numpunct_cache<char> num_cache_c;
num_cache_c* __npc = new (&numpunct_cache_c) num_cache_c(2); num_cache_c* __npc = new (&numpunct_cache_c) num_cache_c(2);
_M_init_facet(new (&numpunct_c) numpunct<char>(__npc, 1)); _M_init_facet(new (&numpunct_c) numpunct<char>(__npc, 1));
...@@ -304,11 +310,20 @@ namespace std ...@@ -304,11 +310,20 @@ namespace std
_M_init_facet(new (&num_get_c) num_get<char>(1)); _M_init_facet(new (&num_get_c) num_get<char>(1));
_M_init_facet(new (&num_put_c) num_put<char>(1)); _M_init_facet(new (&num_put_c) num_put<char>(1));
_M_init_facet(new (&collate_c) std::collate<char>(1)); _M_init_facet(new (&collate_c) std::collate<char>(1));
_M_init_facet(new (&moneypunct_fc) moneypunct<char, false>(1));
_M_init_facet(new (&moneypunct_tc) moneypunct<char, true>(1)); typedef __moneypunct_cache<char> money_cache_c;
money_cache_c* __mpcf = new (&moneypunct_cache_cf) money_cache_c(2);
_M_init_facet(new (&moneypunct_cf) moneypunct<char, false>(__mpcf, 1));
money_cache_c* __mpct = new (&moneypunct_cache_ct) money_cache_c(2);
_M_init_facet(new (&moneypunct_ct) moneypunct<char, true>(__mpct, 1));
_M_init_facet(new (&money_get_c) money_get<char>(1)); _M_init_facet(new (&money_get_c) money_get<char>(1));
_M_init_facet(new (&money_put_c) money_put<char>(1)); _M_init_facet(new (&money_put_c) money_put<char>(1));
_M_init_facet(new (&timepunct_c) __timepunct<char>(1));
typedef __timepunct_cache<char> time_cache_c;
time_cache_c* __tpc = new (&timepunct_cache_c) time_cache_c(2);
_M_init_facet(new (&timepunct_c) __timepunct<char>(__tpc, 1));
_M_init_facet(new (&time_get_c) time_get<char>(1)); _M_init_facet(new (&time_get_c) time_get<char>(1));
_M_init_facet(new (&time_put_c) time_put<char>(1)); _M_init_facet(new (&time_put_c) time_put<char>(1));
_M_init_facet(new (&messages_c) std::messages<char>(1)); _M_init_facet(new (&messages_c) std::messages<char>(1));
...@@ -324,21 +339,36 @@ namespace std ...@@ -324,21 +339,36 @@ namespace std
_M_init_facet(new (&num_get_w) num_get<wchar_t>(1)); _M_init_facet(new (&num_get_w) num_get<wchar_t>(1));
_M_init_facet(new (&num_put_w) num_put<wchar_t>(1)); _M_init_facet(new (&num_put_w) num_put<wchar_t>(1));
_M_init_facet(new (&collate_w) std::collate<wchar_t>(1)); _M_init_facet(new (&collate_w) std::collate<wchar_t>(1));
_M_init_facet(new (&moneypunct_fw) moneypunct<wchar_t, false>(1));
_M_init_facet(new (&moneypunct_tw) moneypunct<wchar_t, true>(1)); typedef __moneypunct_cache<wchar_t> money_cache_w;
money_cache_w* __mpwf = new (&moneypunct_cache_wf) money_cache_w(2);
_M_init_facet(new (&moneypunct_wf) moneypunct<wchar_t, false>(__mpwf, 1));
money_cache_w* __mpwt = new (&moneypunct_cache_wt) money_cache_w(2);
_M_init_facet(new (&moneypunct_wt) moneypunct<wchar_t, true>(__mpwt, 1));
_M_init_facet(new (&money_get_w) money_get<wchar_t>(1)); _M_init_facet(new (&money_get_w) money_get<wchar_t>(1));
_M_init_facet(new (&money_put_w) money_put<wchar_t>(1)); _M_init_facet(new (&money_put_w) money_put<wchar_t>(1));
_M_init_facet(new (&timepunct_w) __timepunct<wchar_t>(1));
typedef __timepunct_cache<wchar_t> time_cache_w;
time_cache_w* __tpw = new (&timepunct_cache_w) time_cache_w(2);
_M_init_facet(new (&timepunct_w) __timepunct<wchar_t>(__tpw, 1));
_M_init_facet(new (&time_get_w) time_get<wchar_t>(1)); _M_init_facet(new (&time_get_w) time_get<wchar_t>(1));
_M_init_facet(new (&time_put_w) time_put<wchar_t>(1)); _M_init_facet(new (&time_put_w) time_put<wchar_t>(1));
_M_init_facet(new (&messages_w) std::messages<wchar_t>(1)); _M_init_facet(new (&messages_w) std::messages<wchar_t>(1));
#endif #endif
// This locale is safe to pre-cache, after all the facets have // This locale is safe to pre-cache, after all the facets have
// been installed. // been created and installed.
_M_caches[numpunct<char>::id._M_id()] = __npc; _M_caches[numpunct<char>::id._M_id()] = __npc;
_M_caches[moneypunct<char, false>::id._M_id()] = __mpcf;
_M_caches[moneypunct<char, true>::id._M_id()] = __mpct;
_M_caches[__timepunct<char>::id._M_id()] = __tpc;
#ifdef _GLIBCXX_USE_WCHAR_T #ifdef _GLIBCXX_USE_WCHAR_T
_M_caches[numpunct<wchar_t>::id._M_id()] = __npw; _M_caches[numpunct<wchar_t>::id._M_id()] = __npw;
_M_caches[moneypunct<wchar_t, false>::id._M_id()] = __mpwf;
_M_caches[moneypunct<wchar_t, true>::id._M_id()] = __mpwt;
_M_caches[__timepunct<wchar_t>::id._M_id()] = __tpw;
#endif #endif
} }
......
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