[Libreoffice-commits] core.git: helpcompiler/inc helpcompiler/source

Noel Grandin noel.grandin at collabora.co.uk
Mon Jan 15 06:27:52 UTC 2018


 helpcompiler/inc/BasCodeTagger.hxx    |    3 ++-
 helpcompiler/source/BasCodeTagger.cxx |    6 +-----
 2 files changed, 3 insertions(+), 6 deletions(-)

New commits:
commit a2f86708a5740ce9fd2a3a6ab69685d8fb53dd6c
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Jan 12 08:22:09 2018 +0200

    loplugin:useuniqueptr in BasicCodeTagger
    
    Change-Id: I85b7d5b3030d4b3ec5318e4ee6793927c1f16355
    Reviewed-on: https://gerrit.libreoffice.org/47835
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

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") ) ) )


More information about the Libreoffice-commits mailing list