[Libreoffice-commits] core.git: starmath/inc starmath/source
Takeshi Abe
tabe at fixedpoint.jp
Tue Mar 14 04:21:39 UTC 2017
starmath/inc/parse.hxx | 2 +-
starmath/source/parse.cxx | 12 +++++-------
2 files changed, 6 insertions(+), 8 deletions(-)
New commits:
commit 4c4b2d98b22a7b0559ba822e998792a2185142b0
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date: Mon Mar 13 17:38:38 2017 +0900
starmath: Return SmBracebodyNode from DoBracebody()
to skip a push to the stack immediately followed by a pop.
Change-Id: I97eb48db2521d640acec4d8080cceb56561eb901
Reviewed-on: https://gerrit.libreoffice.org/35129
Reviewed-by: Takeshi Abe <tabe at fixedpoint.jp>
Tested-by: Takeshi Abe <tabe at fixedpoint.jp>
diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx
index 5393b3c..d402213 100644
--- a/starmath/inc/parse.hxx
+++ b/starmath/inc/parse.hxx
@@ -83,7 +83,7 @@ class SmParser
void DoFontSize();
void DoColor();
void DoBrace();
- void DoBracebody(bool bIsLeftRight);
+ SmBracebodyNode *DoBracebody(bool bIsLeftRight);
void DoFunction();
void DoBinom();
void DoStack();
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index a0f43c2..3edefe7 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -1939,8 +1939,7 @@ void SmParser::DoBrace()
pLeft.reset(new SmMathSymbolNode(m_aCurToken));
NextToken();
- DoBracebody(true);
- pBody.reset(popOrZero(m_aNodeStack));
+ pBody.reset(DoBracebody(true));
if (m_aCurToken.eType == TRIGHT)
{ NextToken();
@@ -1967,8 +1966,7 @@ void SmParser::DoBrace()
pLeft.reset(new SmMathSymbolNode(m_aCurToken));
NextToken();
- DoBracebody(false);
- pBody.reset(popOrZero(m_aNodeStack));
+ pBody.reset(DoBracebody(false));
SmTokenType eExpectedType = TUNKNOWN;
switch (pLeft->GetToken().eType)
@@ -2006,9 +2004,9 @@ void SmParser::DoBrace()
Error(eError);
}
-void SmParser::DoBracebody(bool bIsLeftRight)
+SmBracebodyNode *SmParser::DoBracebody(bool bIsLeftRight)
{
- std::unique_ptr<SmStructureNode> pBody(new SmBracebodyNode(m_aCurToken));
+ auto pBody = o3tl::make_unique<SmBracebodyNode>(m_aCurToken);
sal_uInt16 nNum = 0;
// get body if any
@@ -2062,7 +2060,7 @@ void SmParser::DoBracebody(bool bIsLeftRight)
pBody->SetSubNodes(aNodes);
pBody->SetScaleMode(bIsLeftRight ? SCALE_HEIGHT : SCALE_NONE);
- m_aNodeStack.push_front(std::move(pBody));
+ return pBody.release();
}
void SmParser::DoFunction()
More information about the Libreoffice-commits
mailing list