diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2017-03-13 17:38:38 +0900 |
---|---|---|
committer | Takeshi Abe <tabe@fixedpoint.jp> | 2017-03-14 04:21:03 +0000 |
commit | 4c4b2d98b22a7b0559ba822e998792a2185142b0 (patch) | |
tree | 86813ad78ad64e4cc2d507db6256ab9ecf2e97d3 /starmath/source | |
parent | 951fcc6556346e19a028443c70dea27d0cbc9c36 (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/source')
-rw-r--r-- | starmath/source/parse.cxx | 12 |
1 files changed, 5 insertions, 7 deletions
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() |