summaryrefslogtreecommitdiff
path: root/hwpfilter
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2017-10-08 20:35:23 +0200
committerJulien Nabet <serval2412@yahoo.fr>2017-10-09 23:06:05 +0200
commitadb946f9845dff9f5a53010b38032247b30475c1 (patch)
treea45c157f96ff74176762cc15cf63c898579e433e /hwpfilter
parentaf7b62ea9e54dba4923b004ef921a20c83c2a836 (diff)
Replace list by vector for nodelist var (hwpfilter)
Change-Id: I693d01f63b8bd8b2c78bfd98e1f9310c965f65b2 Reviewed-on: https://gerrit.libreoffice.org/43262 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'hwpfilter')
-rw-r--r--hwpfilter/source/formula.cxx9
-rw-r--r--hwpfilter/source/grammar.cxx13
-rw-r--r--hwpfilter/source/nodes.h5
3 files changed, 10 insertions, 17 deletions
diff --git a/hwpfilter/source/formula.cxx b/hwpfilter/source/formula.cxx
index c3d3b9ce4f2b..5ab06f91dd9b 100644
--- a/hwpfilter/source/formula.cxx
+++ b/hwpfilter/source/formula.cxx
@@ -613,12 +613,9 @@ void Formula::parse()
if( res ){
makeMathML( res );
}
- int count = nodelist.size();
- for( i = 0 ; i < count ; i++ ){
- const Node *tmpNode = nodelist.front();
- nodelist.pop_front();
- delete tmpNode;
- }
+ for (const auto &node : nodelist)
+ delete node;
+ nodelist.clear();
}
void Formula::trim()
diff --git a/hwpfilter/source/grammar.cxx b/hwpfilter/source/grammar.cxx
index 8c593a01315a..ec0fae08411a 100644
--- a/hwpfilter/source/grammar.cxx
+++ b/hwpfilter/source/grammar.cxx
@@ -28,7 +28,7 @@
#define YYMAXDEPTH 0
#endif
-#include <list>
+#include <vector>
#include <stdlib.h>
#include <string.h>
@@ -40,7 +40,7 @@ extern "C" {
#include "grammar.h"
}
-std::list<Node*> nodelist;
+std::vector<Node*> nodelist;
void yyerror(const char *);
@@ -1191,12 +1191,9 @@ void yyerror(const char * /*err*/)
{
// printf("REALKING ERR[%s]\n",err);
// if error, delete all nodes.
- int ncount = nodelist.size();
- for( int i = 0 ; i < ncount ; i++){
- Node *pNode = nodelist.front();
- nodelist.pop_front();
- delete pNode;
- }
+ for (const auto &node : nodelist)
+ delete node;
+ nodelist.clear();
top = nullptr;
}
diff --git a/hwpfilter/source/nodes.h b/hwpfilter/source/nodes.h
index 01fc85fad7ef..61db3a818137 100644
--- a/hwpfilter/source/nodes.h
+++ b/hwpfilter/source/nodes.h
@@ -22,7 +22,7 @@
#include <sal/config.h>
-#include <list>
+#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <osl/diagnose.h>
@@ -94,8 +94,7 @@ public:
Node *child;
Node *next;
};
-
-extern std::list<Node *> nodelist;
+extern std::vector<Node *> nodelist;
#endif