]> git.lyx.org Git - lyx.git/commitdiff
* operator==(docstring const & l, char const * r): optimized a bit because it showed...
authorAbdelrazak Younes <younes@lyx.org>
Sat, 21 Apr 2007 22:39:04 +0000 (22:39 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sat, 21 Apr 2007 22:39:04 +0000 (22:39 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17897 a592a061-630c-0410-9148-cb99ea01b6c8

src/support/docstring.C

index 57dbc19768bacfa95b32617674f1c239ff9a624d..5e9c9a5e7ebaa7b1f65e0faded437708377e5e80 100644 (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';
 }