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
This commit is contained in:
Paolo Carlini 2004-04-15 08:27:29 +00:00 committed by Paolo Carlini
parent ea7b98d0c3
commit d7ed521ba9
2 changed files with 15 additions and 3 deletions

View 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.

View 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&