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

Takeshi Abe tabe at fixedpoint.jp
Thu Nov 19 16:20:48 PST 2015


 starmath/source/parse.cxx |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit 186f365a2c541c51e404b1fa819f35c9152adaf1
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Thu Nov 19 19:14:23 2015 +0900

    starmath: Use std::unique_ptr for exception safety
    
    Change-Id: Idc71dc410000b88463440dd18f41ff945b7616d7

diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index 7cc0667..dded575 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -992,11 +992,11 @@ void SmParser::DoTable()
 void SmParser::DoAlign()
     // parse alignment info (if any), then go on with rest of expression
 {
-    SmStructureNode *pSNode = nullptr;
+    std::unique_ptr<SmStructureNode> pSNode;
 
     if (TokenInGroup(TGALIGN))
     {
-        pSNode = new SmAlignNode(m_aCurToken);
+        pSNode.reset(new SmAlignNode(m_aCurToken));
 
         NextToken();
 
@@ -1004,7 +1004,6 @@ void SmParser::DoAlign()
         if (TokenInGroup(TGALIGN))
         {
             Error(PE_DOUBLE_ALIGN);
-            delete pSNode;
             return;
         }
     }
@@ -1014,7 +1013,7 @@ void SmParser::DoAlign()
     if (pSNode)
     {
         pSNode->SetSubNode(0, popOrZero(m_aNodeStack));
-        m_aNodeStack.push_front(std::unique_ptr<SmStructureNode>(pSNode));
+        m_aNodeStack.push_front(std::move(pSNode));
     }
 }
 


More information about the Libreoffice-commits mailing list