sc/source/filter/xml/XMLStylesImportHelper.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 32726168948ead21d455f2f836c788d1a665dad1
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Aug 31 10:55:51 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Aug 31 21:25:26 2022 +0200

    cid#1509196 Inefficient vector resizing with reserve.
    
    preserve the benefits of reserving with the benefits of logarithmic
    doubling
    
    Change-Id: I52f610218adf4f10cfe1a714728ef3c4c3956a8a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139084
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sc/source/filter/xml/XMLStylesImportHelper.cxx 
b/sc/source/filter/xml/XMLStylesImportHelper.cxx
index e52466a54c4c..3d4bade0e2b8 100644
--- a/sc/source/filter/xml/XMLStylesImportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesImportHelper.cxx
@@ -299,7 +299,7 @@ void ScMyStylesImportHelper::AddColumnStyle(const OUString& 
sStyleName, const sa
 {
     OSL_ENSURE(static_cast<sal_uInt32>(nColumn) == aColDefaultStyles.size(), 
"some columns are absent");
     ScMyStylesMap::iterator aItr(GetIterator(sStyleName));
-    aColDefaultStyles.reserve(aColDefaultStyles.size() + nRepeat);
+    aColDefaultStyles.reserve(std::max<size_t>(aColDefaultStyles.size() + 
nRepeat, aColDefaultStyles.size() * 2));
     for (sal_Int32 i = 0; i < nRepeat; ++i)
         aColDefaultStyles.push_back(aItr);
 }

Reply via email to