diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-08-31 10:59:13 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-08-31 21:26:26 +0200 |
commit | 00c03d8947d05e17086aaa48dba6ed70d5eb0078 (patch) | |
tree | 1a3a45058bec800a7ecc193bd82e03dc5d06aa5a /svx | |
parent | 32726168948ead21d455f2f836c788d1a665dad1 (diff) |
cid#1509246 Inefficient vector resizing with reserve.
preserve the benefits of reserving with the benefits of logarithmic
doubling
Change-Id: I0d15c4a5b4f1890c71b27c71169d9364f6448370
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139086
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/table/tablerow.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/svx/source/table/tablerow.cxx b/svx/source/table/tablerow.cxx index 2b65fc0529fc..5ea999413c3d 100644 --- a/svx/source/table/tablerow.cxx +++ b/svx/source/table/tablerow.cxx @@ -113,7 +113,7 @@ void TableRow::insertColumns( sal_Int32 nIndex, sal_Int32 nCount, CellVector::it maCells.insert( maCells.begin() + nIndex, *pIter, (*pIter) + nCount ); else { - maCells.reserve( maCells.size() + nCount ); + maCells.reserve( std::max<size_t>(maCells.size() + nCount, maCells.size() * 2) ); for ( sal_Int32 i = 0; i < nCount; i++ ) maCells.insert( maCells.begin() + nIndex + i, mxTableModel->createCell() ); } |