diff options
author | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-06-30 04:35:49 +0000 |
---|---|---|
committer | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-06-30 04:35:49 +0000 |
commit | 23e98236d68486406594078cd901d36508878139 (patch) | |
tree | 995ded702483dea4d437f12cb2404f0b4cc96c79 /libstdc++-v3/src | |
parent | d6afc2422f11c5fa802c6e43e3a6b722a99a72be (diff) | |
download | ppe42-gcc-23e98236d68486406594078cd901d36508878139.tar.gz ppe42-gcc-23e98236d68486406594078cd901d36508878139.zip |
2001-06-29 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/locale_facets.tcc (locale::combine): Clone _Impl.
before replacing facet.
* include/bits/localefwd.h (locale::_Impl::_M_remove_reference):
Correct decrement.
* src/localename.cc (locale::_Impl): Correct ctor initialization
lists. Initialize ref count with one. Simplify.
* src/locale.cc: Add comment.
* testsuite/22_locale/numpunct.cc (test01): Add derivation test.
* testsuite/22_locale/numpunct_char_members.cc (test01): Add tests.
* testsuite/22_locale/members.cc (test02): Fix.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@43661 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/src')
-rw-r--r-- | libstdc++-v3/src/locale.cc | 1 | ||||
-rw-r--r-- | libstdc++-v3/src/localename.cc | 8 |
2 files changed, 4 insertions, 5 deletions
diff --git a/libstdc++-v3/src/locale.cc b/libstdc++-v3/src/locale.cc index b72d7ffe0b6..de4f9838148 100644 --- a/libstdc++-v3/src/locale.cc +++ b/libstdc++-v3/src/locale.cc @@ -362,6 +362,7 @@ namespace std locale::locale(const locale& __other) throw() { (_M_impl = __other._M_impl)->_M_add_reference(); } + // This is used to initialize global and classic locales. locale::locale(_Impl* __ip) throw() : _M_impl(__ip) { __ip->_M_add_reference(); } diff --git a/libstdc++-v3/src/localename.cc b/libstdc++-v3/src/localename.cc index e4bc18fefe6..ff98ee3202f 100644 --- a/libstdc++-v3/src/localename.cc +++ b/libstdc++-v3/src/localename.cc @@ -47,7 +47,7 @@ namespace std // Clone existing _Impl object. locale::_Impl:: _Impl(const _Impl& __imp, size_t __refs) - : _M_references(__refs - 1), _M_facets(0), _M_c_locale(0) // XXX + : _M_references(__refs), _M_facets(0), _M_c_locale(0) // XXX { try { _M_facets = new __vec_facet(*(__imp._M_facets)); } @@ -69,7 +69,7 @@ namespace std // Construct named _Impl, including the standard "C" locale. locale::_Impl:: _Impl(string __str, size_t __refs) - : _M_references(__refs - 1), _M_facets(0) + : _M_references(__refs), _M_facets(0) { // Initialize the underlying locale model, which also checks to // see if the given name is valid. @@ -184,8 +184,7 @@ namespace std // Replacing an existing facet. // Order matters, here: __fp->_M_add_reference(); - if (__fpr) - __fpr->_M_remove_reference(); + __fpr->_M_remove_reference(); __fpr = __fp; } else @@ -198,4 +197,3 @@ namespace std } } } // namespace std - |