From 3f1285aa686561025eb3fd48629bd41bc2e31bc0 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Fri, 1 Feb 2008 17:04:59 +0000 Subject: [PATCH] abdel likes short code git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22740 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/support/lstrings.cpp | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/support/lstrings.cpp b/src/support/lstrings.cpp index 672608f9fa..8c0633fd7d 100644 --- a/src/support/lstrings.cpp +++ b/src/support/lstrings.cpp @@ -477,11 +477,7 @@ bool prefixIs(string const & a, string const & pre) { size_t const prelen = pre.length(); size_t const alen = a.length(); - - if (prelen > alen || a.empty()) - return false; - else - return a.compare(0, prelen, pre) == 0; + return prelen <= alen && !a.empty() && 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 alen = a.length(); - - if (prelen > alen || a.empty()) - return false; - else - return a.compare(0, prelen, pre) == 0; + return prelen <= alen && !a.empty() && 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 alen = a.length(); - if (suflen > alen) - return false; - else - return a.compare(alen - suflen, suflen, suf) == 0; + return suflen <= alen && a.compare(alen - suflen, suflen, suf) == 0; }