summaryrefslogtreecommitdiff
path: root/src/lib/aplwc_internal.h
diff options
context:
space:
mode:
authorpeter <peter@pmikkelsen.com>2026-09-03 19:31:52 +0000
committerpeter <peter@pmikkelsen.com>2026-09-03 19:31:52 +0000
commitfa6a3ee5b24d5e227798330cff5f9ff060d6d863 (patch)
treeb251207d74ae183b0e0bb155e4e0f9f86334c3d3 /src/lib/aplwc_internal.h
parent84dd0d9fa985c1c740b3145c6b0d858cca978911 (diff)
Don't dynamically allocate external reference counted pointers, just use what the user puts on the stack.
FossilOrigin-Name: 270cf0d72050bea15fc40a1e2811ba642e3ef26cbe1fa6231c5aa6f1872ccb34
Diffstat (limited to 'src/lib/aplwc_internal.h')
-rw-r--r--src/lib/aplwc_internal.h16
1 files changed, 5 insertions, 11 deletions
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]; \