linguistic/source/gciterator.cxx |   12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

New commits:
commit 4bad8cb5fd321b10ad648ea1674a9f790c5aef1a
Author:     Simon Chenery <simon_chen...@yahoo.com>
AuthorDate: Tue Jan 14 17:14:26 2025 +0100
Commit:     Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>
CommitDate: Wed Jan 22 20:48:07 2025 +0100

    tdf#153109 Use any_of to check for match in gciterator.cxx
    
    Change-Id: Ieadc725272dbab7a4e5e04abb4682879051e6d16
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180247
    Tested-by: Jenkins
    Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>

diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index e2acf1e9d0e6..72276c48caff 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -55,6 +55,7 @@
 #include <comphelper/diagnose_ex.hxx>
 
 #include <map>
+#include <algorithm>
 
 #include <linguistic/misc.hxx>
 
@@ -120,17 +121,10 @@ const sal_Unicode aWhiteSpaces[] =
    const sal_Int32 PROOFINFO_GET_PROOFRESULT = 1;
    const sal_Int32 PROOFINFO_MARK_PARAGRAPH = 2;
 
-const int nWhiteSpaces = SAL_N_ELEMENTS( aWhiteSpaces );
-
 static bool lcl_IsWhiteSpace( sal_Unicode cChar )
 {
-    bool bFound = false;
-    for (int i = 0;  i < nWhiteSpaces && !bFound;  ++i)
-    {
-        if (cChar == aWhiteSpaces[i])
-            bFound = true;
-    }
-    return bFound;
+    return std::any_of(std::begin(aWhiteSpaces), std::end(aWhiteSpaces),
+        [&cChar](const sal_Unicode c) { return c == cChar; });
 }
 
 static sal_Int32 lcl_SkipWhiteSpaces( const OUString &rText, sal_Int32 
nStartPos )

Reply via email to