[Libreoffice-commits] .: svx/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jan 24 03:04:39 PST 2013


 svx/source/table/tablelayouter.cxx |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit a01a537602204f2831b3caf78b7cb23c5e9194eb
Author: K_Karthikeyan <karthikeyan at kacst.edu.sa>
Date:   Sun Jan 20 10:12:24 2013 +0300

    Replace the frequent functioncalls
    
    The function getHorizontalEdge contains more function calls to the
    getRowCount().  Instead we store the return value of getRowCount()
    value in a const integer varible nRowCount and use it.
    
    Change-Id: I3e1460913099d1060d5005329e0b63e5ebcd362c
    Reviewed-on: https://gerrit.libreoffice.org/1777
    Reviewed-by: Radek Doulík <rodo at novell.com>
    Tested-by: Radek Doulík <rodo at novell.com>

diff --git a/svx/source/table/tablelayouter.cxx b/svx/source/table/tablelayouter.cxx
index 27bf185..d01a993 100644
--- a/svx/source/table/tablelayouter.cxx
+++ b/svx/source/table/tablelayouter.cxx
@@ -222,15 +222,16 @@ SvxBorderLine* TableLayouter::getBorderLine( sal_Int32 nEdgeX, sal_Int32 nEdgeY,
 sal_Int32 TableLayouter::getHorizontalEdge( int nEdgeY, sal_Int32* pnMin /*= 0*/, sal_Int32* pnMax /*= 0*/ )
 {
     sal_Int32 nRet = 0;
-    if( (nEdgeY >= 0) && (nEdgeY <= getRowCount() ) )
-        nRet = maRows[std::min((sal_Int32)nEdgeY,getRowCount()-1)].mnPos;
+    const sal_Int32 nRowCount = getRowCount();
+    if( (nEdgeY >= 0) && (nEdgeY <= nRowCount ) )
+        nRet = maRows[std::min((sal_Int32)nEdgeY,nRowCount-1)].mnPos;
 
-    if( nEdgeY == getRowCount() )
+    if( nEdgeY == nRowCount )
         nRet += maRows[nEdgeY - 1].mnSize;
 
     if( pnMin )
     {
-        if( (nEdgeY > 0) && (nEdgeY <= getRowCount() ) )
+        if( (nEdgeY > 0) && (nEdgeY <= nRowCount ) )
         {
             *pnMin = maRows[nEdgeY-1].mnPos + 600; // todo
         }
@@ -265,7 +266,7 @@ sal_Int32 TableLayouter::getVerticalEdge( int nEdgeX, sal_Int32* pnMin /*= 0*/,
     }
     else
     {
-        if( nEdgeX == getColumnCount() )
+        if( nEdgeX == nColCount )
             nRet += maColumns[nEdgeX - 1].mnSize;
     }
 


More information about the Libreoffice-commits mailing list