aboutsummaryrefslogtreecommitdiff
path: root/types.h
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2021-07-30 13:36:29 -0700
committerBruce Hill <bruce@bruce-hill.com>2021-07-30 13:36:29 -0700
commitf3954ac151721dbc190f18fad054829c7f76c92e (patch)
tree994ce534f6a37253c34e7c94971cc1cbe95b3ae6 /types.h
parent253bb1dbe1c1de9b3e2e46a899429ac3d7ed3354 (diff)
Linked list management cleanup
Diffstat (limited to 'types.h')
-rw-r--r--types.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/types.h b/types.h
index 4085218..158178d 100644
--- a/types.h
+++ b/types.h
@@ -92,6 +92,12 @@ typedef struct pat_s {
size_t id;
} pat_t;
+typedef struct {
+ struct match_s **home, *next;
+} match_dll_t;
+
+// #define MATCH_FROM(node, name) ((match_t*)((char*)node + (size_t)(&((match_t*)0)->name)))
+
//
// Pattern matching result object
//
@@ -99,12 +105,8 @@ typedef struct match_s {
// Where the match starts and ends (end is after the last character)
const char *start, *end;
pat_t *pat;
- // Intrusive linked list nodes for garbage collection:
- struct match_s *next;
-#ifdef DEBUG_HEAP
- struct match_s **home;
-#endif
- struct match_s *cache_next, **cache_home;
+ // Intrusive linked list nodes for garbage collection and cache buckets:
+ match_dll_t gc, cache;
size_t defs_id;
int refcount;
// If skip_replacement is set to 1, that means the user wants to not print