diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-31 14:46:38 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-01 12:15:22 +0000 |
commit | 2489000d3fd66319a8355fd4e37cfdfda47296d0 (patch) | |
tree | caad79e7b5bec3863604b20190b682c0d73d2b25 /starmath | |
parent | gpg4libre: Support building --with-system-gpgme (Linux only so far) (diff) | |
download | core-2489000d3fd66319a8355fd4e37cfdfda47296d0.tar.gz core-2489000d3fd66319a8355fd4e37cfdfda47296d0.zip |
loplugin:useuniqueptr extend to check local vars
just the simple and obvious case for now, of a local var being allocated
and deleted inside a single local block, and the delete happening at the
end of the block
Change-Id: I3a7a094da543debdcd2374737c2ecff91d644625
Reviewed-on: https://gerrit.libreoffice.org/33749
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/source/mathmlexport.cxx | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx index e3cad9559e5b..c3135675ca93 100644 --- a/starmath/source/mathmlexport.cxx +++ b/starmath/source/mathmlexport.cxx @@ -611,8 +611,8 @@ void SmXMLExport::ExportBinaryHorizontal(const SmNode *pNode, int nLevel) { TG nGroup = pNode->GetToken().nGroup; - SvXMLElementExport* pRow = new SvXMLElementExport(*this, - XML_NAMESPACE_MATH, XML_MROW, true, true); + std::unique_ptr<SvXMLElementExport> pRow( new SvXMLElementExport(*this, + XML_NAMESPACE_MATH, XML_MROW, true, true) ); // Unfold the binary tree structure as long as the nodes are SmBinHorNode // with the same nGroup. This will reduce the number of nested <mrow> @@ -638,8 +638,6 @@ void SmXMLExport::ExportBinaryHorizontal(const SmNode *pNode, int nLevel) s.push(binNode->Symbol()); s.push(binNode->LeftOperand()); } - - delete pRow; } void SmXMLExport::ExportUnaryHorizontal(const SmNode *pNode, int nLevel) @@ -707,8 +705,8 @@ void SmXMLExport::ExportBinaryDiagonal(const SmNode *pNode, int nLevel) { // widebslash // We can not use <mfrac> to a backslash, so just use <mo>\</mo> - SvXMLElementExport *pRow = new SvXMLElementExport(*this, - XML_NAMESPACE_MATH, XML_MROW, true, true); + std::unique_ptr<SvXMLElementExport> pRow( new SvXMLElementExport(*this, + XML_NAMESPACE_MATH, XML_MROW, true, true) ); ExportNodes(pNode->GetSubNode(0), nLevel); @@ -720,8 +718,6 @@ void SmXMLExport::ExportBinaryDiagonal(const SmNode *pNode, int nLevel) } ExportNodes(pNode->GetSubNode(1), nLevel); - - delete pRow; } } |