svx/source/dialog/charmap.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
New commits: commit ed9b5ae144df24f4da6b2eca3db87fe29aaff542 Author: Julien Nabet <serval2...@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 <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@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; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits