[Libreoffice-commits] core.git: dbaccess/source extensions/source

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 2 21:24:40 UTC 2021


 dbaccess/source/core/api/HelperCollections.cxx |    2 +-
 extensions/source/propctrlr/formlinkdialog.cxx |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit da9fe0da11687bfc4c0eff2197286da67d6206c2
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Wed Jun 2 21:23:42 2021 +0200
Commit:     Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Wed Jun 2 23:22:03 2021 +0200

    Initialize vector directly with the already known count number
    
    instead of initializing an empty vector then reserve a fixed value
    
    Change-Id: Iccddda05b3dd98aa9c25a61637ece7af4d42d72f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116624
    Tested-by: Jenkins
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/dbaccess/source/core/api/HelperCollections.cxx b/dbaccess/source/core/api/HelperCollections.cxx
index dfc18badc688..12ab6414dfed 100644
--- a/dbaccess/source/core/api/HelperCollections.cxx
+++ b/dbaccess/source/core/api/HelperCollections.cxx
@@ -53,7 +53,7 @@ namespace dbaccess
     std::unique_ptr<OPrivateColumns> OPrivateColumns::createWithIntrinsicNames( const ::rtl::Reference< ::connectivity::OSQLColumns >& _rColumns,
         bool _bCase, ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex )
     {
-        std::vector< OUString > aNames; aNames.reserve( _rColumns->size() );
+        std::vector< OUString > aNames(_rColumns->size());
 
         OUString sColumName;
         for (auto const& column : *_rColumns)
diff --git a/extensions/source/propctrlr/formlinkdialog.cxx b/extensions/source/propctrlr/formlinkdialog.cxx
index 7f2d794b4010..f367179b7a1c 100644
--- a/extensions/source/propctrlr/formlinkdialog.cxx
+++ b/extensions/source/propctrlr/formlinkdialog.cxx
@@ -185,8 +185,8 @@ namespace pcr
     void FormLinkDialog::commitLinkPairs()
     {
         // collect the field lists from the rows
-        std::vector< OUString > aDetailFields; aDetailFields.reserve( 4 );
-        std::vector< OUString > aMasterFields; aMasterFields.reserve( 4 );
+        std::vector< OUString > aDetailFields(4);
+        std::vector< OUString > aMasterFields(4);
 
         const FieldLinkRow* aRows[] = {
             m_xRow1.get(), m_xRow2.get(), m_xRow3.get(), m_xRow4.get()


More information about the Libreoffice-commits mailing list