From fa6a3ee5b24d5e227798330cff5f9ff060d6d863 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 3 Sep 2026 19:31:52 +0000 Subject: Don't dynamically allocate external reference counted pointers, just use what the user puts on the stack. FossilOrigin-Name: 270cf0d72050bea15fc40a1e2811ba642e3ef26cbe1fa6231c5aa6f1872ccb34 --- src/lib/aplwc_internal.h | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src/lib/aplwc_internal.h') diff --git a/src/lib/aplwc_internal.h b/src/lib/aplwc_internal.h index 0a52bb1..d72c289 100644 --- a/src/lib/aplwc_internal.h +++ b/src/lib/aplwc_internal.h @@ -37,7 +37,7 @@ struct aplwc { uint8_t *unaligned_data; size_t size; struct memory_ptr_frame *memptrs; - struct root_ptr *rootptrs; + struct aplwc_ref *refs; unsigned int reachable_bit:1; }; @@ -47,12 +47,6 @@ struct memory_ptr_frame { size_t count; }; -struct root_ptr { - int id; - void *ptr; - struct root_ptr *link; -}; - struct aplwc_line { struct string *text; struct token_list *tokens; @@ -120,13 +114,13 @@ struct token_list *memory_alloc_token_list(struct aplwc *, size_t); struct aplwc_value *memory_alloc_aplwc_value(struct aplwc *); struct aplwc_module *memory_alloc_aplwc_module(struct aplwc *); struct module_imports *memory_alloc_module_imports(struct aplwc *, size_t); -struct aplwc_ref memory_root_new(struct aplwc *, void *); -void *memory_root_get(struct aplwc_ref); -void memory_root_free(struct aplwc_ref); +void memory_root_new(struct aplwc *, void *, struct aplwc_ref *); +void *memory_root_get(struct aplwc_ref *); +void memory_root_free(struct aplwc_ref *); void memptrs_add(struct aplwc *, struct memory_ptr_frame *, void ***, size_t); void memptrs_remove(struct aplwc *, struct memory_ptr_frame *); void clear_ref(struct aplwc_ref *); -int valid_ref(struct aplwc_ref); +int valid_ref(struct aplwc_ref *); #define MEMPTRS(aplwc, n) \ void **memptrs[n]; \ -- cgit v1.2.3