diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-04-29 22:07:13 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-04-29 22:07:13 +0000 |
commit | 3c8b970bb51c6bebc6983813aff50f144106b79f (patch) | |
tree | 16ffb66f1bba7a562833063b1655ef9b2136e06f /libstdc++-v3 | |
parent | 34787dd1993c8b8f3a38728647570cc0289db78b (diff) | |
download | gcc-3c8b970bb51c6bebc6983813aff50f144106b79f.tar.gz |
2004-04-29 Paolo Carlini <pcarlini@suse.de>
* src/locale.cc (locale::operator==): Always avoid constructing
locale::name(), directly compare pairs of _M_names.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@81309 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 5 | ||||
-rw-r--r-- | libstdc++-v3/src/locale.cc | 14 |
2 files changed, 12 insertions, 7 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 410070ae9cf..f61c6444e72 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2004-04-29 Paolo Carlini <pcarlini@suse.de> + + * src/locale.cc (locale::operator==): Always avoid constructing + locale::name(), directly compare pairs of _M_names. + 2004-04-26 Paolo Carlini <pcarlini@suse.de> * include/bits/istream.tcc: Fix comment. diff --git a/libstdc++-v3/src/locale.cc b/libstdc++-v3/src/locale.cc index 0ed2dbb8820..af4f34de708 100644 --- a/libstdc++-v3/src/locale.cc +++ b/libstdc++-v3/src/locale.cc @@ -70,15 +70,15 @@ namespace std bool locale::operator==(const locale& __rhs) const throw() { - bool __ret = false; + bool __ret = true; if (_M_impl == __rhs._M_impl) - __ret = true; + ; + else if (!std::strcmp(_M_impl->_M_names[0], "*")) + __ret = false; else - { - const string __name = this->name(); - if (__name != "*" && __name == __rhs.name()) - __ret = true; - } + for (size_t __i = 0; __ret && __i < _S_categories_size; ++__i) + __ret = !std::strcmp(_M_impl->_M_names[__i], + __rhs._M_impl->_M_names[__i]); return __ret; } |