[Libreoffice-commits] core.git: 4 commits - sc/source
Eike Rathke
erack at redhat.com
Thu Aug 25 13:52:18 UTC 2016
sc/source/core/inc/interpre.hxx | 4 ----
sc/source/core/tool/interpr1.cxx | 6 +++---
sc/source/core/tool/interpr4.cxx | 18 ++++++------------
3 files changed, 9 insertions(+), 19 deletions(-)
New commits:
commit 4d6dc9b84b0afd31a380e71fd53a3bc99d403430
Author: Eike Rathke <erack at redhat.com>
Date: Thu Aug 25 15:50:31 2016 +0200
ditch the now unused ever cloning PushTempToken(const formula::FormulaToken&)
Change-Id: I0d09039a5f9cb797b5b72f3ee9044eab7c8f05c5
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 6551f5b..e454daa 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -264,10 +264,6 @@ void Push( const formula::FormulaToken& r );
explicit formula::FormulaErrorToken. Increments RefCount. */
void PushWithoutError( const formula::FormulaToken& r );
-/** Clones the token to be pushed or substitutes with formula::FormulaErrorToken if
- nGlobalError is set and the token passed is not formula::FormulaErrorToken. */
-void PushTempToken( const formula::FormulaToken& );
-
/** Does substitute with formula::FormulaErrorToken in case nGlobalError is set and the token
passed is not formula::FormulaErrorToken.
Increments RefCount of the original token if not substituted.
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 2d9ff53..5c39c81 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -705,12 +705,6 @@ void ScInterpreter::PushTempTokenWithoutError( const FormulaToken* p )
}
}
-void ScInterpreter::PushTempToken( const FormulaToken& r )
-{
- if (!IfErrorPushError())
- PushTempTokenWithoutError( r.Clone());
-}
-
void ScInterpreter::PushTokenRef( const formula::FormulaConstTokenRef& x )
{
if ( sp >= MAXSTACK )
commit a7d645f27f4723f38769a5b079765fa98399e8a7
Author: Eike Rathke <erack at redhat.com>
Date: Thu Aug 25 14:08:45 2016 +0200
use PushTokenRef() instead of PushTempToken(const formula::FormulaToken&)
... which unnecessarily clones.
Change-Id: I06ecce94439c2923011f18f69be48a50048c6dde
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 64b151d..2d9ff53 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4394,10 +4394,10 @@ StackVar ScInterpreter::Interpret()
// Not all functions pop all parameters in case an error is
// generated. Clean up stack. Assumes that every function pushes a
// result, may be arbitrary in case of error.
- const FormulaToken* pLocalResult = pStack[ sp - 1 ];
+ FormulaConstTokenRef xLocalResult = pStack[ sp - 1 ];
while (sp > nStackBase)
Pop();
- PushTempToken( *pLocalResult );
+ PushTokenRef( xLocalResult );
}
bool bGotResult;
@@ -4543,13 +4543,13 @@ StackVar ScInterpreter::Interpret()
break;
case svExternalSingleRef:
{
- ScExternalRefCache::TokenRef pToken;
+ FormulaTokenRef xToken;
ScExternalRefCache::CellFormat aFmt;
- PopExternalSingleRef(pToken, &aFmt);
+ PopExternalSingleRef(xToken, &aFmt);
if (nGlobalError)
break;
- PushTempToken(*pToken);
+ PushTokenRef(xToken);
if (aFmt.mbIsSet)
{
commit f26a37e4ad0b74c04b6c19c43c1ad209e6f92756
Author: Eike Rathke <erack at redhat.com>
Date: Thu Aug 25 12:53:48 2016 +0200
use PushWithoutError() when fishing from and pushing to the stack
... so no unnecessary copy is created.
Change-Id: I0fbd31c0b6faf8691405a53884d8740f80d7ad4e
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 85f443f..3d35f6c 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -6645,7 +6645,7 @@ void ScInterpreter::ScSubTotal()
{
// We must fish the 1st parameter deep from the stack! And push it on top.
const FormulaToken* p = pStack[ sp - nParamCount ];
- PushTempToken( *p ); /* TODO: use FormulaTokenRef instead */
+ PushWithoutError( *p );
sal_Int32 nFunc = GetInt32();
mnSubTotalFlags |= SUBTOTAL_IGN_NESTED_ST_AG | SUBTOTAL_IGN_FILTERED;
if (nFunc > 100)
@@ -6692,11 +6692,11 @@ void ScInterpreter::ScAggregate()
{
// fish the 1st parameter from the stack and push it on top.
const FormulaToken* p = pStack[ sp - nParamCount ];
- PushTempToken( *p ); /* TODO: use FormulaTokenRef instead */
+ PushWithoutError( *p );
sal_Int32 nFunc = GetInt32();
// fish the 2nd parameter from the stack and push it on top.
const FormulaToken* p2 = pStack[ sp - ( nParamCount - 1 ) ];
- PushTempToken( *p2 ); /* TODO: use FormulaTokenRef instead */
+ PushWithoutError( *p2 );
sal_Int32 nOption = GetInt32();
if ( nGlobalError || nFunc < 1 || nFunc > 19 )
commit 035fc620b833a853a5ef84a7a05298be8d91a24c
Author: Eike Rathke <erack at redhat.com>
Date: Thu Aug 25 12:38:13 2016 +0200
move the nCurFmtType=UNDEFINED from PushWithoutError()
... to the only place where it makes sense.
Change-Id: I8a2927af97abee28dd0ec89793c4745dcbd0031f
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index c6e3f20..64b151d 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -628,7 +628,6 @@ void ScInterpreter::PushWithoutError( const FormulaToken& r )
SetError( errStackOverflow );
else
{
- nCurFmtType = css::util::NumberFormat::UNDEFINED;
r.IncRef();
if( sp >= maxsp )
maxsp = sp + 1;
@@ -3885,6 +3884,7 @@ StackVar ScInterpreter::Interpret()
{
// RPN code push without error
PushWithoutError( *pCur );
+ nCurFmtType = css::util::NumberFormat::UNDEFINED;
}
else if (pTokenMatrixMap &&
!(eOp == ocIf || eOp == ocIfError || eOp == ocIfNA || eOp == ocChoose) &&
More information about the Libreoffice-commits
mailing list