From 1a5b12aa5da2c718848d3cc5d9bce7bfcdeacf54 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 18 Apr 2019 15:13:19 +0200 Subject: optimise find/insert pattern if we're doing a find/insert on a set or a map, it is better to just do a conditional insert/emplace operation than triggering two lookups. Change-Id: I80da5097f5a89fe30fa348ce5b6e747c34287a8d Reviewed-on: https://gerrit.libreoffice.org/70937 Tested-by: Jenkins Reviewed-by: Noel Grandin --- vcl/osx/a11yfocustracker.cxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'vcl/osx') diff --git a/vcl/osx/a11yfocustracker.cxx b/vcl/osx/a11yfocustracker.cxx index a84b27d38d66..b62c27edfbc7 100644 --- a/vcl/osx/a11yfocustracker.cxx +++ b/vcl/osx/a11yfocustracker.cxx @@ -248,11 +248,8 @@ void AquaA11yFocusTracker::window_got_focus(vcl::Window *pWindow) } else { - if( m_aDocumentWindowList.find(pWindow) == m_aDocumentWindowList.end() ) - { - m_aDocumentWindowList.insert(pWindow); + if( m_aDocumentWindowList.insert(pWindow).second ) m_xDocumentFocusListener->attachRecursive(xAccessible, xContext, xStateSet); - } } } -- cgit