diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-08-31 10:55:51 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-08-31 21:25:26 +0200 |
commit | 32726168948ead21d455f2f836c788d1a665dad1 (patch) | |
tree | dd7e504b58719eea79e96d5723e3b75dc872a102 /sc | |
parent | d8e70a0b831f53961249ef0ac93bab1bc66f2818 (diff) |
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.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/xml/XMLStylesImportHelper.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
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); } |