diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-11-15 10:48:27 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-11-15 12:04:31 +0100 |
commit | d0e848dab096160b16c4778ba25a40d1e5ff82af (patch) | |
tree | fec4a155c91994a19aa3b13599749a2563329685 /sw | |
parent | def8f7699661f3ca9d763b6bd5e81759cf5b4e12 (diff) |
avoid double map lookup
Change-Id: I02018eaaf220c7835756eba6215425bac9cbc6f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159432
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/dbgoutsw.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 5 | ||||
-rw-r--r-- | sw/source/uibase/envelp/labelcfg.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/utlui/content.cxx | 5 |
4 files changed, 12 insertions, 8 deletions
diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx index a6edc6f0cc12..1de4b7153543 100644 --- a/sw/source/core/doc/dbgoutsw.cxx +++ b/sw/source/core/doc/dbgoutsw.cxx @@ -224,8 +224,10 @@ static OUString lcl_dbg_out(const SfxPoolItem & rItem) { OUString aStr("[ "); - if (GetItemWhichMap().find(rItem.Which()) != GetItemWhichMap().end()) - aStr += GetItemWhichMap()[rItem.Which()]; + auto & rWhichMap = GetItemWhichMap(); + auto it = rWhichMap.find(rItem.Which()); + if ( it != rWhichMap.end()) + aStr += it->second; else aStr += OUString::number(rItem.Which()); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 41bed36093cd..ee514c8eea29 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4413,8 +4413,9 @@ static void impl_borders( FSHelperPtr const & pSerializer, { const SvxBorderLine* pLn = rBox.GetLine( *pBrd ); const table::BorderLine2 *aStyleProps = nullptr; - if( rTableStyleConf.find( *pBrd ) != rTableStyleConf.end() ) - aStyleProps = &rTableStyleConf[ *pBrd ]; + auto it = rTableStyleConf.find( *pBrd ); + if( it != rTableStyleConf.end() ) + aStyleProps = &(it->second); if (!tagWritten && rOptions.bWriteTag) { diff --git a/sw/source/uibase/envelp/labelcfg.cxx b/sw/source/uibase/envelp/labelcfg.cxx index 8d98c7a9f1eb..f974a3e799db 100644 --- a/sw/source/uibase/envelp/labelcfg.cxx +++ b/sw/source/uibase/envelp/labelcfg.cxx @@ -251,8 +251,8 @@ void SwLabelConfig::FillLabels(const OUString& rManufacturer, SwLabRecs& rLab bool SwLabelConfig::HasLabel(const OUString& rManufacturer, const OUString& rType) { - return ( ( m_aLabels.find(rManufacturer) != m_aLabels.end() ) && - ( m_aLabels[rManufacturer].find(rType) != m_aLabels[rManufacturer].end() ) ); + auto it = m_aLabels.find(rManufacturer); + return ( it != m_aLabels.end() ) && ( it->second.find(rType) != it->second.end() ); } // label is always saved as a custom label diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 4c126fb6193d..5dc3d87aaf14 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -1135,8 +1135,9 @@ SwContentTree::SwContentTree(std::unique_ptr<weld::TreeView> xTreeView, SwNaviga if (SwView* pView = GetActiveView(); pView && pView->GetDocShell()) { OUString sDocTitle = pView->GetDocShell()->GetTitle(); - if (lcl_DocOutLineExpandStateMap.find(sDocTitle) != lcl_DocOutLineExpandStateMap.end()) - mOutLineNodeMap = lcl_DocOutLineExpandStateMap[sDocTitle]; + auto it = lcl_DocOutLineExpandStateMap.find(sDocTitle); + if (it != lcl_DocOutLineExpandStateMap.end()) + mOutLineNodeMap = it->second; if (comphelper::LibreOfficeKit::isActive()) { if (pView->m_nNaviExpandedStatus < 0) m_nActiveBlock = 1; |