From 1f9468fc29874eae5100317282ab8b395904406d Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 14 Oct 2021 14:57:54 +0200 Subject: use std::vector::insert instead of push_back because it will pre-allocate space and often is optimised to memcpy Change-Id: I03ed7915f2762d3d27e378638052a47a28bbf096 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123588 Tested-by: Jenkins Reviewed-by: Noel Grandin --- cui/source/customize/SvxNotebookbarConfigPage.cxx | 9 ++------- cui/source/dialogs/cuigaldlg.cxx | 7 +------ 2 files changed, 3 insertions(+), 13 deletions(-) (limited to 'cui/source') diff --git a/cui/source/customize/SvxNotebookbarConfigPage.cxx b/cui/source/customize/SvxNotebookbarConfigPage.cxx index 16d555a9a2e7..43b792af8955 100644 --- a/cui/source/customize/SvxNotebookbarConfigPage.cxx +++ b/cui/source/customize/SvxNotebookbarConfigPage.cxx @@ -423,20 +423,15 @@ void SvxNotebookbarConfigPage::SelectElement() if (aEntries[nIdx].sClassId == "svtlo-ManagedMenuButton") { aTempEntries.push_back(aEntries[nIdx]); - std::vector aGtkEntries; sal_Int32 rPos = 1; sActiveCategory = aEntries[nIdx].sUIItemId.getToken(rPos, ':', rPos); - FillFunctionsList(pNodePtr, aGtkEntries, aCategoryList, sActiveCategory); - for (std::size_t Idx = 0; Idx < aGtkEntries.size(); Idx++) - aTempEntries.push_back(aGtkEntries[Idx]); - aGtkEntries.clear(); + FillFunctionsList(pNodePtr, aTempEntries, aCategoryList, sActiveCategory); } else aTempEntries.push_back(aEntries[nIdx]); } - aEntries = aTempEntries; - aTempEntries.clear(); + aEntries = std::move(aTempEntries); weld::TreeView& rTreeView = m_xContentsListBox->get_widget(); rTreeView.bulk_insert_for_each( diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx index 1d1c1429399a..118fb06cce00 100644 --- a/cui/source/dialogs/cuigaldlg.cxx +++ b/cui/source/dialogs/cuigaldlg.cxx @@ -335,12 +335,7 @@ IMPL_LINK_NOARG(TakeProgress, CleanUpHdl, void*, void) if( !aRemoveEntries[ i ] ) aRemainingVector.push_back( m_pTabPage->aFoundList[i] ); - m_pTabPage->aFoundList.clear(); - - for( i = 0, nCount = aRemainingVector.size(); i < nCount; ++i ) - m_pTabPage->aFoundList.push_back( aRemainingVector[ i ] ); - - aRemainingVector.clear(); + m_pTabPage->aFoundList = std::move(aRemainingVector); // refill list box for( i = 0, nCount = aRemoveEntries.size(); i < nCount; ++i ) -- cgit