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

Julien Nabet serval2412 at yahoo.fr
Sun Nov 26 17:02:37 UTC 2017


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

New commits:
commit d8282c9adcd1c10b721bb72d6e4c8f993e862694
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sun Nov 26 16:41:00 2017 +0100

    Replace lists by vector and deque (helpcompiler)
    
    Change-Id: I8d65947f3188ab7b54653eee887de2c5d4f8095d
    Reviewed-on: https://gerrit.libreoffice.org/45290
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/helpcompiler/inc/BasCodeTagger.hxx b/helpcompiler/inc/BasCodeTagger.hxx
index d8dbffa4cd49..7d485b166805 100644
--- a/helpcompiler/inc/BasCodeTagger.hxx
+++ b/helpcompiler/inc/BasCodeTagger.hxx
@@ -13,7 +13,8 @@
 #include <iostream>
 #include <cstdlib>
 #include <string>
-#include <list>
+#include <deque>
+#include <vector>
 #include <libxml/xmlmemory.h>
 #include <libxml/parser.h>
 #include <rtl/ustring.hxx>
@@ -28,7 +29,7 @@ class L10N_DLLPUBLIC BasicCodeTagger
 {
   private:
     xmlDocPtr             m_pDocument;
-    std::list<xmlNodePtr> m_BasicCodeContainerTags;
+    std::vector<xmlNodePtr> m_BasicCodeContainerTags;
     LibXmlTreeWalker   *m_pXmlTreeWalker;
     SyntaxHighlighter     m_Highlighter;
     bool m_bTaggingCompleted;
@@ -50,7 +51,7 @@ class L10N_DLLPUBLIC LibXmlTreeWalker
 {
   private:
     xmlNodePtr            m_pCurrentNode;
-    std::list<xmlNodePtr> m_Queue; //!Queue for breath-first search
+    std::deque<xmlNodePtr> m_Queue; //!Queue for breath-first search
 
   public:
     LibXmlTreeWalker( xmlDocPtr doc );
diff --git a/helpcompiler/inc/HelpCompiler.hxx b/helpcompiler/inc/HelpCompiler.hxx
index 356f8dc5b64d..952e58acc987 100644
--- a/helpcompiler/inc/HelpCompiler.hxx
+++ b/helpcompiler/inc/HelpCompiler.hxx
@@ -152,7 +152,7 @@ struct joaat_hash
 #define pref_hash joaat_hash
 
 typedef std::unordered_map<std::string, std::string, pref_hash> Stringtable;
-typedef std::list<std::string> LinkedList;
+typedef std::deque<std::string> LinkedList;
 typedef std::vector<std::string> HashSet;
 
 typedef std::unordered_map<std::string, LinkedList, pref_hash> Hashtable;
diff --git a/helpcompiler/source/BasCodeTagger.cxx b/helpcompiler/source/BasCodeTagger.cxx
index 20a4f1bb8061..215ea49996f6 100644
--- a/helpcompiler/source/BasCodeTagger.cxx
+++ b/helpcompiler/source/BasCodeTagger.cxx
@@ -103,19 +103,17 @@ void BasicCodeTagger::getBasicCodeContainerNodes()
 void BasicCodeTagger::tagBasCodeParagraphs()
 {
     //helper variables
-    xmlNodePtr currBascodeNode;
     xmlNodePtr currParagraph;
-    while ( !m_BasicCodeContainerTags.empty() )
+    for (auto const& currBascodeNode : m_BasicCodeContainerTags)
     {
-        currBascodeNode = m_BasicCodeContainerTags.front();
         currParagraph = currBascodeNode->xmlChildrenNode; //first <paragraph>
         while ( currParagraph != nullptr )
         {
             tagParagraph( currParagraph );
             currParagraph=currParagraph->next;
         }
-        m_BasicCodeContainerTags.pop_front(); //next element
     }
+    m_BasicCodeContainerTags.clear();
 }
 
 //! Used by tagBasCodeParagraphs(). It does the work on the current paragraph containing Basic code.


More information about the Libreoffice-commits mailing list