From 77d9007a88a18e0dee08aa9ba93e3aec86375572 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 26 Sep 2021 13:12:02 -0700 Subject: Refactor of pat_t memory management to use doubly linked lists, and moving the recursive freeing code from Lua/lbp.c into pattern.c --- pattern.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'pattern.h') diff --git a/pattern.h b/pattern.h index ef08441..3a78f13 100644 --- a/pattern.h +++ b/pattern.h @@ -42,7 +42,7 @@ enum pattype_e { // A struct reperesenting a BP virtual machine operation // typedef struct pat_s { - struct pat_s *next; + struct pat_s *next, **home; enum pattype_e type; const char *start, *end; // The bounds of the match length (used for backtracking) @@ -115,8 +115,9 @@ pat_t *chain_together(pat_t *first, pat_t *second); pat_t *either_pat(pat_t *first, pat_t *second); __attribute__((nonnull)) maybe_pat_t bp_pattern(const char *str, const char *end); - -void free_pat(pat_t *pat); +void free_all_pats(void); +__attribute__((nonnull)) +void delete_pat(pat_t **at_pat, bool recursive); #endif -- cgit v1.2.3