* operator==(docstring const & l, char const * r): optimized a bit because it showed a lot in profile.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17897 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-04-21 22:39:04 +00:00
parent e841d41a92
commit 1757d1b1cd

View File

@ -148,15 +148,16 @@ docstring const normalize_kc(docstring const & s)
bool operator==(lyx::docstring const & l, char const * r)
{
int const len = l.length();
for (int i = 0; i < len; ++i) {
BOOST_ASSERT(static_cast<unsigned char>(r[i]) < 0x80);
if (!r[i])
lyx::docstring::const_iterator it = l.begin();
lyx::docstring::const_iterator end = l.end();
for (; it != end; ++it, ++r) {
BOOST_ASSERT(static_cast<unsigned char>(*r) < 0x80);
if (!*r)
return false;
if (l[i] != lyx::docstring::value_type(r[i]))
if (*it != static_cast<lyx::docstring::value_type>(*r))
return false;
}
return r[len] == '\0';
return *r == '\0';
}