locale.cc (locale::operator==): Always avoid constructing locale::name(), directly...
authorPaolo Carlini <pcarlini@suse.de>
Thu, 29 Apr 2004 22:07:13 +0000 (22:07 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 29 Apr 2004 22:07:13 +0000 (22:07 +0000)
2004-04-29  Paolo Carlini  <pcarlini@suse.de>

* src/locale.cc (locale::operator==): Always avoid constructing
locale::name(), directly compare pairs of _M_names.

From-SVN: r81309

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

index 410070ae9cf4eef58c28f0a793a2732692f77a96..f61c6444e728f401a7e7d7e45ba5f9c5f80d2aaf 100644 (file)
@@ -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.
index 0ed2dbb8820be16d9059ba728edff257efa10d99..af4f34de708d138d601c7ca3c89b43aea9854449 100644 (file)
@@ -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;
   }