diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2017-11-04 17:07:06 +0100 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-04 20:00:49 +0100 |
commit | ed9b5ae144df24f4da6b2eca3db87fe29aaff542 (patch) | |
tree | 43579a7ea2e6a6ea3ac3ce979d18fdd6651796ef | |
parent | 98bc7215935f1eb2e0dc6f1db826d8e729430c13 (diff) |
Optimize loop of GetSubsetByUnicode a bit (svx)
Change-Id: I568c08b5c319aefbe77a1abb720421a88555568d
Reviewed-on: https://gerrit.libreoffice.org/44305
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | svx/source/dialog/charmap.cxx | 7 |
1 files changed, 3 insertions, 4 deletions
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; } |