Kaydet (Commit) 186f365a authored tarafından Takeshi Abe's avatar Takeshi Abe

starmath: Use std::unique_ptr for exception safety

Change-Id: Idc71dc410000b88463440dd18f41ff945b7616d7
üst 11b7a2c8
......@@ -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));
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment