[Libreoffice-commits] core.git: starmath/source

Takeshi Abe tabe at fixedpoint.jp
Fri Apr 22 01:40:55 UTC 2016


 starmath/source/parse.cxx |   15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

New commits:
commit ebc76403c4acb8fc176dd1239b930c1e7529bde7
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Tue Apr 19 18:52:49 2016 +0900

    starmath: Simplify SmParser::DoTable()
    
    yet doing the same.
    
    Change-Id: I2ebdcb96179830eb02af8ed12dd27c69a78ed276
    Reviewed-on: https://gerrit.libreoffice.org/24240
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Takeshi Abe <tabe at fixedpoint.jp>

diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index 955e3e1..ada838a 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));


More information about the Libreoffice-commits mailing list