diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-10-14 14:57:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-10-14 21:28:40 +0200 |
commit | 1f9468fc29874eae5100317282ab8b395904406d (patch) | |
tree | 7da605653b3a979d18c2283f42ac8a3efd9eae63 /cui/source | |
parent | 43b0d4f709a3a1446a32e36abb5deaa3bb45ddd9 (diff) |
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cui/source')
-rw-r--r-- | cui/source/customize/SvxNotebookbarConfigPage.cxx | 9 | ||||
-rw-r--r-- | cui/source/dialogs/cuigaldlg.cxx | 7 |
2 files changed, 3 insertions, 13 deletions
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<NotebookbarEntries> 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 ) |