summaryrefslogtreecommitdiff
path: root/lib/regfree.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/regfree.cc')
-rw-r--r--lib/regfree.cc60
1 files changed, 20 insertions, 40 deletions
diff --git a/lib/regfree.cc b/lib/regfree.cc
index 005b961a..e837ba61 100644
--- a/lib/regfree.cc
+++ b/lib/regfree.cc
@@ -3,7 +3,7 @@
#include <valarray>
#include <vector>
-#include "lib/regcomp_dfa_regless.h"
+#include "lib/regcomp_dfa_multipass.h"
#include "lib/regex.h"
#include "lib/regex_impl.h"
#include "lib/regoff_trie.h"
@@ -14,22 +14,12 @@
#include "src/parse/ast.h"
#include "src/regexp/rule.h"
#include "src/regexp/tag.h"
-#include "src/util/free_list.h"
#include "src/util/range.h"
-
using namespace re2c;
using namespace re2c::libre2c;
-void regfree(regex_t *preg)
-{
- delete preg->rmgr;
-
- delete &preg->nfa->charset;
- delete &preg->nfa->rules;
- delete &preg->nfa->tags;
- delete preg->nfa;
-
+void regfree(regex_t* preg) {
if (preg->flags & REG_TSTRING) {
delete[] preg->tstring.string;
} else if (preg->flags & REG_SUBHIST) {
@@ -39,49 +29,39 @@ void regfree(regex_t *preg)
}
if (preg->flags & REG_NFA) {
+ delete preg->nfa;
if ((preg->flags & REG_TRIE) && (preg->flags & REG_LEFTMOST)) {
delete static_cast<lzsimctx_t*>(preg->simctx);
} else if (preg->flags & REG_TRIE) {
delete static_cast<pzsimctx_t*>(preg->simctx);
} else if (preg->flags & REG_LEFTMOST) {
delete static_cast<lsimctx_t*>(preg->simctx);
- } else if (preg->flags & REG_KUKLEWICZ) {
- delete static_cast<ksimctx_t*>(preg->simctx);
} else {
delete static_cast<psimctx_t*>(preg->simctx);
}
} else {
- delete[] preg->char2class;
- delete[] preg->dfa->finvers;
-
- delete &preg->dfa->mtagvers;
- delete &preg->dfa->tcpool;
- delete preg->dfa;
-
- if (preg->flags & REG_REGLESS) {
- if (preg->flags & REG_LEFTMOST) {
- delete static_cast<ldetctx_t*>(preg->rldfa->ctx);
- } else {
- delete static_cast<pdetctx_t*>(preg->rldfa->ctx);
+ if (preg->flags & REG_MULTIPASS) {
+ delete preg->mptdfa->opts;
+ delete[] preg->mptdfa->result;
+ delete preg->mptdfa;
+ if (preg->flags & REG_SUBHIST) {
+ delete preg->regtrie;
}
- delete preg->rldfa->opts;
- delete[] preg->rldfa->result;
- delete preg->rldfa;
- }
- if (preg->flags & REG_TSTRING) {
- // t-string construction does not use this
- } else if (preg->flags & REG_SUBHIST) {
- delete preg->regtrie;
} else {
- delete[] preg->regs;
+ delete &preg->dfa->dfa_alc;
+ delete preg->dfa;
+ if (preg->flags & REG_TSTRING) {
+ // t-string construction does not use this
+ } else if (preg->flags & REG_SUBHIST) {
+ delete preg->regtrie;
+ } else {
+ delete[] preg->regs;
+ }
}
+ delete[] preg->char2class;
}
-
- AST::flist.clear();
- RangeSuffix::freeList.clear();
}
-void regfreesub(subhistory_t *history)
-{
+void regfreesub(subhistory_t* history) {
free(history);
}