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

Eike Rathke erack at redhat.com
Fri Jan 16 12:58:17 PST 2015


 sc/source/core/data/column4.cxx |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 15e802fabbfff047c1a8d768dea8fc04a2f82a49
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Jan 16 21:54:24 2015 +0100

    replace decrementing loop with -=
    
    This could save a million iterations ...
    
    Change-Id: I44fb228b951580bbeb5df5f6ec7be933077776ff

diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index b997948..a162ca7 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -1476,8 +1476,9 @@ void ScColumn::EndListeningGroup( sc::EndListeningContext& rCxt, SCROW nRow )
 
     // Move back to the top cell.
     SCROW nTopDelta = (*pp)->aPos.Row() - xGroup->mpTopCell->aPos.Row();
-    for (SCROW i = 0; i < nTopDelta; ++i)
-        --pp;
+    assert(nTopDelta >= 0);
+    if (nTopDelta > 0)
+        pp -= nTopDelta;
 
     // Set the needs listening flag to all cells in the group.
     assert(*pp == xGroup->mpTopCell);
@@ -1505,8 +1506,9 @@ void ScColumn::SetNeedsListeningGroup( SCROW nRow )
 
     // Move back to the top cell.
     SCROW nTopDelta = (*pp)->aPos.Row() - xGroup->mpTopCell->aPos.Row();
-    for (SCROW i = 0; i < nTopDelta; ++i)
-        --pp;
+    assert(nTopDelta >= 0);
+    if (nTopDelta > 0)
+        pp -= nTopDelta;
 
     // Set the needs listening flag to all cells in the group.
     assert(*pp == xGroup->mpTopCell);


More information about the Libreoffice-commits mailing list