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

Takeshi Abe tabe at fixedpoint.jp
Fri Mar 10 09:00:12 UTC 2017


 starmath/inc/parse.hxx    |    2 +-
 starmath/source/parse.cxx |   12 +++++-------
 2 files changed, 6 insertions(+), 8 deletions(-)

New commits:
commit 657a791349f8cd5b1aa271ac7c75ce5b5b2a859f
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Fri Mar 10 10:37:11 2017 +0900

    starmath: Return SmGlyphSpecialNode from DoGlyphSpecial()
    
    instead of pushing it to the stack. This spares some pops.
    
    Change-Id: I9fc987ebf851ff6387e347a2878ff01f482d8f7f
    Reviewed-on: https://gerrit.libreoffice.org/35029
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Takeshi Abe <tabe at fixedpoint.jp>

diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx
index 6804b1a..5393b3c 100644
--- a/starmath/inc/parse.hxx
+++ b/starmath/inc/parse.hxx
@@ -89,7 +89,7 @@ class SmParser
     void    DoStack();
     void    DoMatrix();
     void    DoSpecial();
-    void    DoGlyphSpecial();
+    SmGlyphSpecialNode *DoGlyphSpecial();
     // end of grammar
 
     void    Error(SmParseError Error);
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index cf1dcc8..a0f43c2 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -1124,9 +1124,7 @@ void SmParser::DoProduct()
                 //Let the glyph node know it's a binary operation
                 m_aCurToken.eType = TBOPER;
                 m_aCurToken.nGroup = TG::Product;
-
-                DoGlyphSpecial();
-                pOper = popOrZero(m_aNodeStack);
+                pOper = DoGlyphSpecial();
                 break;
 
             case TOVERBRACE :
@@ -1660,8 +1658,7 @@ void SmParser::DoUnOper()
             //Let the glyph know what it is...
             m_aCurToken.eType = TUOPER;
             m_aCurToken.nGroup = TG::UnOper;
-            DoGlyphSpecial();
-            pOper = popOrZero(m_aNodeStack);
+            pOper = DoGlyphSpecial();
             break;
 
         case TPLUS :
@@ -2253,10 +2250,11 @@ void SmParser::DoSpecial()
     NextToken();
 }
 
-void SmParser::DoGlyphSpecial()
+SmGlyphSpecialNode *SmParser::DoGlyphSpecial()
 {
-    m_aNodeStack.push_front(o3tl::make_unique<SmGlyphSpecialNode>(m_aCurToken));
+    auto pNode = o3tl::make_unique<SmGlyphSpecialNode>(m_aCurToken);
     NextToken();
+    return pNode.release();
 }
 
 void SmParser::Error(SmParseError eError)


More information about the Libreoffice-commits mailing list