summaryrefslogtreecommitdiff
path: root/helpcompiler
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-01-12 08:22:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-01-15 07:27:12 +0100
commita2f86708a5740ce9fd2a3a6ab69685d8fb53dd6c (patch)
tree3943a9e6e1e38c21be50be787f3c2c7c42c7c376 /helpcompiler
parent215254415fc32b754eb948a5c374b14366773afb (diff)
loplugin:useuniqueptr in BasicCodeTagger
Change-Id: I85b7d5b3030d4b3ec5318e4ee6793927c1f16355 Reviewed-on: https://gerrit.libreoffice.org/47835 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'helpcompiler')
-rw-r--r--helpcompiler/inc/BasCodeTagger.hxx3
-rw-r--r--helpcompiler/source/BasCodeTagger.cxx6
2 files changed, 3 insertions, 6 deletions
diff --git a/helpcompiler/inc/BasCodeTagger.hxx b/helpcompiler/inc/BasCodeTagger.hxx
index 7d485b166805..228f86fd6a18 100644
--- a/helpcompiler/inc/BasCodeTagger.hxx
+++ b/helpcompiler/inc/BasCodeTagger.hxx
@@ -14,6 +14,7 @@
#include <cstdlib>
#include <string>
#include <deque>
+#include <memory>
#include <vector>
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
@@ -30,7 +31,7 @@ class L10N_DLLPUBLIC BasicCodeTagger
private:
xmlDocPtr m_pDocument;
std::vector<xmlNodePtr> m_BasicCodeContainerTags;
- LibXmlTreeWalker *m_pXmlTreeWalker;
+ std::unique_ptr<LibXmlTreeWalker> m_pXmlTreeWalker;
SyntaxHighlighter m_Highlighter;
bool m_bTaggingCompleted;
void tagParagraph( xmlNodePtr paragraph );
diff --git a/helpcompiler/source/BasCodeTagger.cxx b/helpcompiler/source/BasCodeTagger.cxx
index 215ea49996f6..f59c1d268e0d 100644
--- a/helpcompiler/source/BasCodeTagger.cxx
+++ b/helpcompiler/source/BasCodeTagger.cxx
@@ -62,8 +62,6 @@ BasicCodeTagger::BasicCodeTagger( xmlDocPtr rootDoc ):
BasicCodeTagger::~BasicCodeTagger()
{
- if ( m_pXmlTreeWalker != nullptr )
- delete m_pXmlTreeWalker;
}
//!Gathers all the <bascode> tag nodes from xml tree.
/*!
@@ -75,9 +73,7 @@ void BasicCodeTagger::getBasicCodeContainerNodes()
m_BasicCodeContainerTags.clear();
- if ( m_pXmlTreeWalker != nullptr )
- delete m_pXmlTreeWalker;
- m_pXmlTreeWalker = new LibXmlTreeWalker( m_pDocument );
+ m_pXmlTreeWalker.reset(new LibXmlTreeWalker( m_pDocument ));
currentNode = m_pXmlTreeWalker->currentNode();
if ( !( xmlStrcmp( currentNode->name, reinterpret_cast<const xmlChar*>("bascode") ) ) )