diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-24 14:24:00 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-24 14:24:00 +0000 |
commit | 97aafeda647b35569794da79c795739ccf57ea98 (patch) | |
tree | 687ec98bea5e95a432e9d9929a0427ec5b517632 | |
parent | ef7722f02820d23b3c280fc4a17b2bd862ac67a2 (diff) | |
download | gcc-97aafeda647b35569794da79c795739ccf57ea98.tar.gz |
2003-10-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/basic_ios.tcc (copyfmt(const basic_ios&)):
Tweak my fix for libstdc++/12657.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72895 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | libstdc++-v3/ChangeLog | 5 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/basic_ios.tcc | 89 |
2 files changed, 49 insertions, 45 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 2b96b005b3c..eecb7bc5940 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,10 @@ 2003-10-24 Paolo Carlini <pcarlini@suse.de> + * include/bits/basic_ios.tcc (copyfmt(const basic_ios&)): + Tweak my fix for libstdc++/12657. + +2003-10-24 Paolo Carlini <pcarlini@suse.de> + * include/bits/locale_facets.tcc (money_get::do_get(..., string_type&): Minor tweak to the previous commit. diff --git a/libstdc++-v3/include/bits/basic_ios.tcc b/libstdc++-v3/include/bits/basic_ios.tcc index 541453afb31..45cc894f67c 100644 --- a/libstdc++-v3/include/bits/basic_ios.tcc +++ b/libstdc++-v3/include/bits/basic_ios.tcc @@ -62,53 +62,52 @@ namespace std { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 292. effects of a.copyfmt (a) - if (this == &__rhs) - return *this; - - // Per 27.1.1, do not call imbue, yet must trash all caches - // associated with imbue() - - // Alloc any new word array first, so if it fails we have "rollback". - _Words* __words = (__rhs._M_word_size <= _S_local_word_size) ? - _M_local_word : new _Words[__rhs._M_word_size]; - - // Bump refs before doing callbacks, for safety. - _Callback_list* __cb = __rhs._M_callbacks; - if (__cb) - __cb->_M_add_reference(); - _M_call_callbacks(erase_event); - if (_M_word != _M_local_word) + if (this != &__rhs) { - delete [] _M_word; - _M_word = 0; + // Per 27.1.1, do not call imbue, yet must trash all caches + // associated with imbue() + + // Alloc any new word array first, so if it fails we have "rollback". + _Words* __words = (__rhs._M_word_size <= _S_local_word_size) ? + _M_local_word : new _Words[__rhs._M_word_size]; + + // Bump refs before doing callbacks, for safety. + _Callback_list* __cb = __rhs._M_callbacks; + if (__cb) + __cb->_M_add_reference(); + _M_call_callbacks(erase_event); + if (_M_word != _M_local_word) + { + delete [] _M_word; + _M_word = 0; + } + _M_dispose_callbacks(); + + // NB: Don't want any added during above. + _M_callbacks = __cb; + for (int __i = 0; __i < __rhs._M_word_size; ++__i) + __words[__i] = __rhs._M_word[__i]; + if (_M_word != _M_local_word) + { + delete [] _M_word; + _M_word = 0; + } + _M_word = __words; + _M_word_size = __rhs._M_word_size; + + this->flags(__rhs.flags()); + this->width(__rhs.width()); + this->precision(__rhs.precision()); + this->tie(__rhs.tie()); + this->fill(__rhs.fill()); + _M_ios_locale = __rhs.getloc(); + _M_cache_locale(_M_ios_locale); + + _M_call_callbacks(copyfmt_event); + + // The next is required to be the last assignment. + this->exceptions(__rhs.exceptions()); } - _M_dispose_callbacks(); - - // NB: Don't want any added during above. - _M_callbacks = __cb; - for (int __i = 0; __i < __rhs._M_word_size; ++__i) - __words[__i] = __rhs._M_word[__i]; - if (_M_word != _M_local_word) - { - delete [] _M_word; - _M_word = 0; - } - _M_word = __words; - _M_word_size = __rhs._M_word_size; - - this->flags(__rhs.flags()); - this->width(__rhs.width()); - this->precision(__rhs.precision()); - this->tie(__rhs.tie()); - this->fill(__rhs.fill()); - _M_ios_locale = __rhs.getloc(); - _M_cache_locale(_M_ios_locale); - - _M_call_callbacks(copyfmt_event); - - // The next is required to be the last assignment. - this->exceptions(__rhs.exceptions()); - return *this; } |