From 3cd61e3abc79a80d38afa9c633c59585aeb0311a Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 14 Jan 2021 19:21:31 -0800 Subject: Overhaul of memory tracking and left recursion. Added explanation doc for left recursion and fixed all visible memory leaks. --- types.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'types.h') diff --git a/types.h b/types.h index b8c2b68..30a0e9e 100644 --- a/types.h +++ b/types.h @@ -39,7 +39,7 @@ enum VMOpcode { VM_REF, VM_BACKREF, VM_NODENT, - VM_CANNED, + VM_LEFTRECURSION, }; struct match_s; // forward declared to resolve circular struct defs @@ -80,7 +80,7 @@ typedef struct vm_op_s { unsigned int visits; const char *at; struct vm_op_s *fallback; - } canned; + } leftrec; struct vm_op_s *pat; } args; } vm_op_t; @@ -93,7 +93,9 @@ typedef struct match_s { const char *start, *end; struct match_s *child, *nextsibling; vm_op_t *op; - unsigned int refcount; + // Intrusive linked list nodes for garbage collection: + struct match_s **atme, *next; + int refcount; } match_t; // -- cgit v1.2.3