[Libreoffice-commits] core.git: svx/source

Julien Nabet serval2412 at yahoo.fr
Sat Nov 4 19:01:16 UTC 2017


 svx/source/dialog/charmap.cxx |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit ed9b5ae144df24f4da6b2eca3db87fe29aaff542
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sat Nov 4 17:07:06 2017 +0100

    Optimize loop of GetSubsetByUnicode a bit (svx)
    
    Change-Id: I568c08b5c319aefbe77a1abb720421a88555568d
    Reviewed-on: https://gerrit.libreoffice.org/44305
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
index 39de2ab5ecbe..b529e3a9ebfa 100644
--- a/svx/source/dialog/charmap.cxx
+++ b/svx/source/dialog/charmap.cxx
@@ -976,10 +976,9 @@ const Subset* SubsetMap::GetNextSubset( bool bFirst ) const
 
 const Subset* SubsetMap::GetSubsetByUnicode( sal_UCS4 cChar ) const
 {
-    // TODO: is it worth to avoid a linear search?
-    for( const Subset* s = GetNextSubset( true ); s; s = GetNextSubset( false ) )
-        if( (s->GetRangeMin() <= cChar) && (cChar <= s->GetRangeMax()) )
-            return s;
+    for (auto const& subset : maSubsets)
+        if( (subset.GetRangeMin() <= cChar) && (cChar <= subset.GetRangeMax()) )
+            return ⊂
     return nullptr;
 }
 


More information about the Libreoffice-commits mailing list