From: Paolo Carlini Date: Thu, 15 Apr 2004 08:27:29 +0000 (+0000) Subject: locale.cc (locale::operator==): When _M_impl == __rhs._M_impl avoid constructing... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d7ed521ba9f35bdd450f1cc31c76c6ece8063634;p=gcc.git locale.cc (locale::operator==): When _M_impl == __rhs._M_impl avoid constructing unnecessarily this->name(). 2004-04-15 Paolo Carlini * src/locale.cc (locale::operator==): When _M_impl == __rhs._M_impl avoid constructing unnecessarily this->name(). From-SVN: r80714 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index f123374268d..491f75d7d0c 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2004-04-15 Paolo Carlini + + * src/locale.cc (locale::operator==): When _M_impl == __rhs._M_impl + avoid constructing unnecessarily this->name(). + 2004-04-14 Zack Weinberg * testsuite/Makefile.am: Add definition of AM_CXXFLAGS. diff --git a/libstdc++-v3/src/locale.cc b/libstdc++-v3/src/locale.cc index 7021b65ec58..0ed2dbb8820 100644 --- a/libstdc++-v3/src/locale.cc +++ b/libstdc++-v3/src/locale.cc @@ -70,9 +70,16 @@ namespace std bool locale::operator==(const locale& __rhs) const throw() { - string __name = this->name(); - return (_M_impl == __rhs._M_impl - || (__name != "*" && __name == __rhs.name())); + bool __ret = false; + if (_M_impl == __rhs._M_impl) + __ret = true; + else + { + const string __name = this->name(); + if (__name != "*" && __name == __rhs.name()) + __ret = true; + } + return __ret; } const locale&