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 --- sc/source/filter/excel/xestyle.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'sc/source/filter/excel') diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index 1af2b2187149..9e48fd5fc7b2 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -3020,10 +3020,8 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot ) aStyleName = pEntry->GetStyleName(); } - if (maStyleNameToDxfId.find(aStyleName) == maStyleNameToDxfId.end()) + if (maStyleNameToDxfId.emplace(aStyleName, nIndex).second) { - maStyleNameToDxfId.insert(std::pair(aStyleName, nIndex)); - SfxStyleSheetBase* pStyle = rRoot.GetDoc().GetStyleSheetPool()->Find(aStyleName); if(!pStyle) continue; -- cgit