diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2015-11-19 19:14:23 +0900 |
---|---|---|
committer | Takeshi Abe <tabe@fixedpoint.jp> | 2015-11-20 09:09:35 +0900 |
commit | 186f365a2c541c51e404b1fa819f35c9152adaf1 (patch) | |
tree | cee8dd20764db31c93329d8242515ab60662f4f3 /starmath | |
parent | 11b7a2c89b8e155bf1da79107878f066847b46eb (diff) |
starmath: Use std::unique_ptr for exception safety
Change-Id: Idc71dc410000b88463440dd18f41ff945b7616d7
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/source/parse.cxx | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index 7cc066797da1..dded5750985d 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)); } } |