]> granicus.if.org Git - re2c/commitdiff
Free memory allocated for range suffies at the same time as everything else.
authorUlya Trofimovich <skvadrik@gmail.com>
Tue, 4 Aug 2015 10:36:13 +0000 (11:36 +0100)
committerUlya Trofimovich <skvadrik@gmail.com>
Tue, 4 Aug 2015 10:36:13 +0000 (11:36 +0100)
Moved static member definition closer to class.

re2c/src/ir/regexp/encoding/range_suffix.h
re2c/src/ir/regexp/regexp.cc
re2c/src/main.cc
re2c/src/parse/parser.ypp

index f4c0e96b511a1c6521648ab49fc9a4b12349c829..669bacd26b7b7c896acb6126663d80761220df3c 100644 (file)
@@ -11,11 +11,10 @@ namespace re2c {
 
 class RegExp; // forward
 
-class RangeSuffix
+struct RangeSuffix
 {
        static free_list<RangeSuffix *> freeList;
 
-public:
        uint32_t l;
        uint32_t h;
        RangeSuffix * next;
index 4f57a8a24988d7ea99f399b5e0da91880948adf9..89cf7e58dd5a5529c1cb12c21a8d87f95502834b 100644 (file)
@@ -13,6 +13,8 @@ namespace re2c
 
 static MatchOp * merge (MatchOp * m1, MatchOp * m2);
 
+free_list<RegExp*> RegExp::vFreeList;
+
 RegExp * doAlt (RegExp * e1, RegExp * e2)
 {
        if (!e1)
index 78cbe78f0fd5aba899be1e2b721a431640929f56..550e04c297e71382965f46dcc1bce5f8e66ba8bf 100644 (file)
@@ -12,7 +12,6 @@ bool bWroteGetState = false;
 bool bWroteCondCheck = false;
 uint32_t last_fill_index = 0;
 CodeNames mapCodeName;
-free_list<RegExp*> RegExp::vFreeList;
 
 } // end namespace re2c
 
index c8a263b4fd82decca1ad96d215bcfa9bce5c5611..3e0fac108729a9d685e47ee13cbfd60aa140775f 100644 (file)
@@ -9,6 +9,7 @@
 
 #include "config.h"
 #include "src/ir/bytecode/bytecode.h"
+#include "src/ir/regexp/encoding/range_suffix.h"
 #include "src/ir/regexp/regexp_cat.h"
 #include "src/ir/regexp/regexp_close.h"
 #include "src/ir/regexp/regexp_closev.h"
@@ -712,6 +713,7 @@ void parse_cleanup()
 {
        RegExp::vFreeList.clear();
        Range::vFreeList.clear();
+       RangeSuffix::freeList.clear();
        symbol_table.clear ();
        specMap.clear();
        specStar.clear();