summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2017-03-13 17:38:38 +0900
committerTakeshi Abe <tabe@fixedpoint.jp>2017-03-14 04:21:03 +0000
commit4c4b2d98b22a7b0559ba822e998792a2185142b0 (patch)
tree86813ad78ad64e4cc2d507db6256ab9ecf2e97d3 /starmath
parent951fcc6556346e19a028443c70dea27d0cbc9c36 (diff)
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@fixedpoint.jp> Tested-by: Takeshi Abe <tabe@fixedpoint.jp>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/inc/parse.hxx2
-rw-r--r--starmath/source/parse.cxx12
2 files changed, 6 insertions, 8 deletions
diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx
index 5393b3cb4b75..d4022137c2e9 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 a0f43c26f8cc..3edefe77626b 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()