diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-04 18:03:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-05 09:28:27 +0200 |
commit | 80f990b8e3d05e47e041685a7811f1352d03ad4d (patch) | |
tree | 2b2c045c75544767499aea0d2b18e1890e9b9566 /sw | |
parent | c2139cafe6240991f88b85c1df12613d0ae0e821 (diff) |
clang-tidy performance-inefficient-vector-operation
Change-Id: Iebcaea7b08c5284946d83b6b6b9ed26b218025d4
Reviewed-on: https://gerrit.libreoffice.org/59992
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/fldui/changedb.cxx | 3 | ||||
-rw-r--r-- | sw/source/ui/fmtui/tmpdlg.cxx | 5 | ||||
-rw-r--r-- | sw/source/ui/misc/num.cxx | 5 |
3 files changed, 8 insertions, 5 deletions
diff --git a/sw/source/ui/fldui/changedb.cxx b/sw/source/ui/fldui/changedb.cxx index d6eefe4b4cd6..12855877550c 100644 --- a/sw/source/ui/fldui/changedb.cxx +++ b/sw/source/ui/fldui/changedb.cxx @@ -94,7 +94,8 @@ void SwChangeDBDlg::FillDBPopup() Sequence< OUString > aDBNames = xDBContext->getElementNames(); const OUString* pDBNames = aDBNames.getConstArray(); sal_Int32 nDBCount = aDBNames.getLength(); - for(sal_Int32 i = 0; i < nDBCount; i++) + aAllDBNames.reserve(nDBCount); + for (sal_Int32 i = 0; i < nDBCount; i++) { aAllDBNames.push_back(pDBNames[i]); } diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx index 8a6524490692..9cdba0b23534 100644 --- a/sw/source/ui/fmtui/tmpdlg.cxx +++ b/sw/source/ui/fmtui/tmpdlg.cxx @@ -518,8 +518,9 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) ::FillCharStyleListBox(*rCharFormatLB.get(), pDocShell); std::vector<OUString> aList; - for(sal_Int32 j = 0; j < rCharFormatLB->GetEntryCount(); j++) - aList.push_back( rCharFormatLB->GetEntry(j) ); + aList.reserve(rCharFormatLB->GetEntryCount()); + for (sal_Int32 j = 0; j < rCharFormatLB->GetEntryCount(); j++) + aList.push_back(rCharFormatLB->GetEntry(j)); aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ; FieldUnit eMetric = ::GetDfltMetric(dynamic_cast< const SwWebDocShell *>( pDocShell ) != nullptr); diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx index c3eaedb5b7e9..b127062e75bf 100644 --- a/sw/source/ui/misc/num.cxx +++ b/sw/source/ui/misc/num.cxx @@ -931,8 +931,9 @@ void SwSvxNumBulletTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage) ::FillCharStyleListBox(*rCharFormatLB.get(), pDocShell); std::vector<OUString> aList; - for(sal_Int32 j = 0; j < rCharFormatLB->GetEntryCount(); j++) - aList.push_back( rCharFormatLB->GetEntry(j) ); + aList.reserve(rCharFormatLB->GetEntryCount()); + for (sal_Int32 j = 0; j < rCharFormatLB->GetEntryCount(); j++) + aList.push_back(rCharFormatLB->GetEntry(j)); aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ; |