summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2016-04-19 18:52:49 +0900
committerTakeshi Abe <tabe@fixedpoint.jp>2016-04-22 01:40:33 +0000
commitebc76403c4acb8fc176dd1239b930c1e7529bde7 (patch)
tree7399e6f88534ca7d560fda149dd4fd69fd7ac7ad
parent11f13f55b7e76811946979f363638597d882b88b (diff)
starmath: Simplify SmParser::DoTable()
yet doing the same. Change-Id: I2ebdcb96179830eb02af8ed12dd27c69a78ed276 Reviewed-on: https://gerrit.libreoffice.org/24240 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
-rw-r--r--starmath/source/parse.cxx15
1 files changed, 5 insertions, 10 deletions
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index 955e3e112630..ada838aeffa2 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -948,8 +948,6 @@ void SmParser::NextToken()
void SmParser::DoTable()
{
- SmNodeArray LineArray;
-
DoLine();
while (m_aCurToken.eType == TNEWLINE)
{
@@ -960,15 +958,12 @@ void SmParser::DoTable()
if (m_aCurToken.eType != TEND)
Error(PE_UNEXPECTED_CHAR);
- auto n = m_aNodeStack.size();
-
- LineArray.resize(n);
-
- for (size_t i = 0; i < n; i++)
+ SmNodeArray LineArray;
+ while (!m_aNodeStack.empty())
{
- auto pNode = std::move(m_aNodeStack.front());
- m_aNodeStack.pop_front();
- LineArray[n - (i + 1)] = pNode.release();
+ auto pNode = std::move(m_aNodeStack.back());
+ m_aNodeStack.pop_back();
+ LineArray.push_back(pNode.release());
}
std::unique_ptr<SmStructureNode> pSNode(new SmTableNode(m_aCurToken));