[Libreoffice-commits] core.git: sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Aug 6 06:53:23 UTC 2018


 sw/source/core/table/swnewtable.cxx |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 61a54ea68e63aee498a3dd938fbb7fe58416046f
Author:     Takeshi Abe <tabe at fixedpoint.jp>
AuthorDate: Mon Aug 6 12:48:17 2018 +0900
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Aug 6 08:53:03 2018 +0200

    sw: Prefer std::vector for SwLineOffsetArray to std::list
    
    as its instance adds an element only at the end, and no erase.
    
    Change-Id: I41dc7c4d0f7d070b7ce0cef2e36ee73c05f342ae
    Reviewed-on: https://gerrit.libreoffice.org/58635
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx
index 4c78fa0d1ceb..33fb40cd0319 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -1201,7 +1201,7 @@ void SwTable::InsertSpannedRow( SwDoc* pDoc, sal_uInt16 nRowIdx, sal_uInt16 nCnt
 }
 
 typedef std::pair< sal_uInt16, sal_uInt16 > SwLineOffset;
-typedef std::list< SwLineOffset > SwLineOffsetArray;
+typedef std::vector< SwLineOffset > SwLineOffsetArray;
 
 /*
 * When a couple of table boxes has to be split,
@@ -1260,8 +1260,7 @@ static void lcl_SophisticatedFillLineIndices( SwLineOffsetArray &rArr,
         }
         OSL_ENSURE( aLnOfs.second < nCnt, "Clean-up failed" );
         aLnOfs.second = nCnt - aLnOfs.second; // the number of rows to insert
-        rArr.insert( rArr.end(),
-            SwLineOffset( aLnOfs.first - nSum, aLnOfs.second ) );
+        rArr.emplace_back( aLnOfs.first - nSum, aLnOfs.second );
         // the correction has to be incremented because in the following
         // loops the line ends were manipulated
         nSum = nSum + aLnOfs.second;


More information about the Libreoffice-commits mailing list