From 6bfa100ffc0e73557464aed15a59407ce666534c Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Tue, 4 Aug 2015 11:36:13 +0100 Subject: [PATCH] Free memory allocated for range suffies at the same time as everything else. Moved static member definition closer to class. --- re2c/src/ir/regexp/encoding/range_suffix.h | 3 +-- re2c/src/ir/regexp/regexp.cc | 2 ++ re2c/src/main.cc | 1 - re2c/src/parse/parser.ypp | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/re2c/src/ir/regexp/encoding/range_suffix.h b/re2c/src/ir/regexp/encoding/range_suffix.h index f4c0e96b..669bacd2 100644 --- a/re2c/src/ir/regexp/encoding/range_suffix.h +++ b/re2c/src/ir/regexp/encoding/range_suffix.h @@ -11,11 +11,10 @@ namespace re2c { class RegExp; // forward -class RangeSuffix +struct RangeSuffix { static free_list freeList; -public: uint32_t l; uint32_t h; RangeSuffix * next; diff --git a/re2c/src/ir/regexp/regexp.cc b/re2c/src/ir/regexp/regexp.cc index 4f57a8a2..89cf7e58 100644 --- a/re2c/src/ir/regexp/regexp.cc +++ b/re2c/src/ir/regexp/regexp.cc @@ -13,6 +13,8 @@ namespace re2c static MatchOp * merge (MatchOp * m1, MatchOp * m2); +free_list RegExp::vFreeList; + RegExp * doAlt (RegExp * e1, RegExp * e2) { if (!e1) diff --git a/re2c/src/main.cc b/re2c/src/main.cc index 78cbe78f..550e04c2 100644 --- a/re2c/src/main.cc +++ b/re2c/src/main.cc @@ -12,7 +12,6 @@ bool bWroteGetState = false; bool bWroteCondCheck = false; uint32_t last_fill_index = 0; CodeNames mapCodeName; -free_list RegExp::vFreeList; } // end namespace re2c diff --git a/re2c/src/parse/parser.ypp b/re2c/src/parse/parser.ypp index c8a263b4..3e0fac10 100644 --- a/re2c/src/parse/parser.ypp +++ b/re2c/src/parse/parser.ypp @@ -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(); -- 2.40.0