diff options
| author | peter <peter@pmikkelsen.com> | 2026-08-31 19:44:56 +0000 |
|---|---|---|
| committer | peter <peter@pmikkelsen.com> | 2026-08-31 19:44:56 +0000 |
| commit | 7f7a2fb4fb23433e7be3d6953725690c8ea958d2 (patch) | |
| tree | e73bc6f3bd9d5132a0262966cd99986027142144 /src/lib/aplwc_internal.h | |
| parent | 729964bea692f9683860978b89848784a7fc2f46 (diff) | |
The objects returned to the user are now integer-based references,
not actual pointers. This means the aplwc internals can update those
pointers without the user noticing.
FossilOrigin-Name: 654c7d0ec85da295a7fb6ed381500410686b280f342fa81a30481f5e9a20c58a
Diffstat (limited to 'src/lib/aplwc_internal.h')
| -rw-r--r-- | src/lib/aplwc_internal.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/lib/aplwc_internal.h b/src/lib/aplwc_internal.h index a7b7030..5320336 100644 --- a/src/lib/aplwc_internal.h +++ b/src/lib/aplwc_internal.h @@ -18,6 +18,7 @@ struct aplwc { uint8_t *unaligned_data; size_t size; struct memory_ptr_frame *memptrs; + struct root_ptr *rootptrs; }; struct memory_ptr_frame { @@ -26,6 +27,12 @@ struct memory_ptr_frame { size_t count; }; +struct root_ptr { + int id; + void *ptr; + struct root_ptr *link; +}; + struct aplwc_line { struct aplwc *aplwc; struct string *text; @@ -95,9 +102,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); -void memory_free_root(struct aplwc *, void *); +struct aplwc_ref memory_root_new(struct aplwc *, void *); +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); #define MEMPTRS(aplwc, n) \ void **memptrs[n]; \ |