diff options
author | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-10-10 05:15:29 +0000 |
---|---|---|
committer | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-10-10 05:15:29 +0000 |
commit | 56a29009c5924087752fa862c9eea37cdb5d7ab9 (patch) | |
tree | 7b9d08c6526562220c7bb210f6e6ce48283f90ea /libstdc++-v3/src/locale.cc | |
parent | 296a25400d0ea70e19d6b89f51d23f1ed7916071 (diff) | |
download | gcc-56a29009c5924087752fa862c9eea37cdb5d7ab9.tar.gz |
2002-10-09 Benjamin Kosnik <bkoz@redhat.com>
* src/locale.cc: Fix comments, move ctors together.
* testsuite/22_locale/static_members.cc (test03): Add.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@58001 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/src/locale.cc')
-rw-r--r-- | libstdc++-v3/src/locale.cc | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/libstdc++-v3/src/locale.cc b/libstdc++-v3/src/locale.cc index 641bee21baa..d9c69313491 100644 --- a/libstdc++-v3/src/locale.cc +++ b/libstdc++-v3/src/locale.cc @@ -148,25 +148,6 @@ namespace std 0 }; - locale::~locale() throw() - { _M_impl->_M_remove_reference(); } - - void - locale::_M_coalesce(const locale& __base, const locale& __add, - category __cat) - { - __cat = _S_normalize_category(__cat); - _M_impl = new _Impl(*__base._M_impl, 1); - - try - { _M_impl->_M_replace_categories(__add._M_impl, __cat); } - catch (...) - { - _M_impl->_M_remove_reference(); - __throw_exception_again; - } - } - locale::locale() throw() { _S_initialize(); @@ -178,6 +159,7 @@ namespace std // This is used to initialize global and classic locales, and // assumes that the _Impl objects are constructed correctly. + // The lack of a reference increment is intentional. locale::locale(_Impl* __ip) throw() : _M_impl(__ip) { } @@ -309,6 +291,9 @@ namespace std locale::locale(const locale& __base, const locale& __add, category __cat) { _M_coalesce(__base, __add, __cat); } + locale::~locale() throw() + { _M_impl->_M_remove_reference(); } + bool locale::operator==(const locale& __rhs) const throw() { @@ -381,7 +366,7 @@ namespace std try { // 26 Standard facets, 2 references. - // One reference for _M_classic, one for _M_global + // One reference for _S_classic, one for _S_global _S_classic = new (&c_locale_impl) _Impl(0, 2, true); _S_global = _S_classic; new (&c_locale) locale(_S_classic); @@ -399,6 +384,22 @@ namespace std return c_locale; } + void + locale::_M_coalesce(const locale& __base, const locale& __add, + category __cat) + { + __cat = _S_normalize_category(__cat); + _M_impl = new _Impl(*__base._M_impl, 1); + + try + { _M_impl->_M_replace_categories(__add._M_impl, __cat); } + catch (...) + { + _M_impl->_M_remove_reference(); + __throw_exception_again; + } + } + locale::category locale::_S_normalize_category(category __cat) { |