svx/source/table/tablerow.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 00c03d8947d05e17086aaa48dba6ed70d5eb0078
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Aug 31 10:59:13 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Aug 31 21:26:26 2022 +0200

    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.gran...@collabora.co.uk>

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() );
     }

Reply via email to