aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2004-04-15 08:27:29 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2004-04-15 08:27:29 +0000
commitd7ed521ba9f35bdd450f1cc31c76c6ece8063634 (patch)
tree3c6f89fc78b1ddd44683e6a2d0f25326e1d6af5b
parentea7b98d0c3db88f34b78693a82909c73c50b0162 (diff)
downloadgcc-d7ed521ba9f35bdd450f1cc31c76c6ece8063634.zip
gcc-d7ed521ba9f35bdd450f1cc31c76c6ece8063634.tar.gz
gcc-d7ed521ba9f35bdd450f1cc31c76c6ece8063634.tar.bz2
locale.cc (locale::operator==): When _M_impl == __rhs._M_impl avoid constructing unnecessarily this->name().
2004-04-15 Paolo Carlini <pcarlini@suse.de> * src/locale.cc (locale::operator==): When _M_impl == __rhs._M_impl avoid constructing unnecessarily this->name(). From-SVN: r80714
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/src/locale.cc13
2 files changed, 15 insertions, 3 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index f123374..491f75d 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,8 @@
+2004-04-15 Paolo Carlini <pcarlini@suse.de>
+
+ * src/locale.cc (locale::operator==): When _M_impl == __rhs._M_impl
+ avoid constructing unnecessarily this->name().
+
2004-04-14 Zack Weinberg <zack@codesourcery.com>
* testsuite/Makefile.am: Add definition of AM_CXXFLAGS.
diff --git a/libstdc++-v3/src/locale.cc b/libstdc++-v3/src/locale.cc
index 7021b65..0ed2dbb 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&