[PATCH] Replace the frequent functioncalls
Karthikeyan Krishnamurthi (via Code Review)
gerrit at gerrit.libreoffice.org
Sat Jan 19 23:21:38 PST 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/1777
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/77/1777/1
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
---
M svx/source/table/tablelayouter.cxx
1 file changed, 6 insertions(+), 5 deletions(-)
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 @@
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 @@
}
else
{
- if( nEdgeX == getColumnCount() )
+ if( nEdgeX == nColCount )
nRet += maColumns[nEdgeX - 1].mnSize;
}
--
To view, visit https://gerrit.libreoffice.org/1777
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e1460913099d1060d5005329e0b63e5ebcd362c
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Karthikeyan Krishnamurthi <karthikeyan at kacst.edu.sa>
More information about the LibreOffice
mailing list