abdel likes short code

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22740 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2008-02-01 17:04:59 +00:00
parent 65ba33308e
commit 3f1285aa68

View File

@ -477,11 +477,7 @@ bool prefixIs(string const & a, string const & pre)
{ {
size_t const prelen = pre.length(); size_t const prelen = pre.length();
size_t const alen = a.length(); size_t const alen = a.length();
return prelen <= alen && !a.empty() && a.compare(0, prelen, pre) == 0;
if (prelen > alen || a.empty())
return false;
else
return a.compare(0, prelen, pre) == 0;
} }
@ -489,11 +485,7 @@ bool prefixIs(docstring const & a, docstring const & pre)
{ {
size_t const prelen = pre.length(); size_t const prelen = pre.length();
size_t const alen = a.length(); size_t const alen = a.length();
return prelen <= alen && !a.empty() && a.compare(0, prelen, pre) == 0;
if (prelen > alen || a.empty())
return false;
else
return a.compare(0, prelen, pre) == 0;
} }
@ -516,10 +508,7 @@ bool suffixIs(string const & a, string const & suf)
{ {
size_t const suflen = suf.length(); size_t const suflen = suf.length();
size_t const alen = a.length(); size_t const alen = a.length();
if (suflen > alen) return suflen <= alen && a.compare(alen - suflen, suflen, suf) == 0;
return false;
else
return a.compare(alen - suflen, suflen, suf) == 0;
} }