]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
locale.cc (locale::operator==): When _M_impl == __rhs._M_impl avoid constructing...
authorPaolo Carlini <pcarlini@suse.de>
Thu, 15 Apr 2004 08:27:29 +0000 (08:27 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 15 Apr 2004 08:27:29 +0000 (08:27 +0000)
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

libstdc++-v3/ChangeLog
libstdc++-v3/src/locale.cc

index f123374268d0973f27416aa5138e2da3c977ec48..491f75d7d0cd54fa98ea20ee2b989506ceafb4da 100644 (file)
@@ -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.
index 7021b65ec582decf0a38a16e87f6b908c444494d..0ed2dbb8820be16d9059ba728edff257efa10d99 100644 (file)
@@ -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&