From 6153bf6edb45e4ad1759e3db69e3a7358ae28b4e Mon Sep 17 00:00:00 2001 From: "Chloe M." Date: Sun, 23 Aug 2026 05:40:51 +0000 Subject: core: Add support for pointer boxes Pointer boxes are a way to manage memory and have all references released after operation, this way they do not need to be manually managed. Signed-off-by: Chloe M. --- core/state.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'core/state.c') diff --git a/core/state.c b/core/state.c index ce1c286..c55a5be 100644 --- a/core/state.c +++ b/core/state.c @@ -9,6 +9,8 @@ int defconf_state_init(const char *in_path, struct defconf_state *state) { + int error; + if (in_path == NULL || state == NULL) { return -1; } @@ -19,6 +21,12 @@ defconf_state_init(const char *in_path, struct defconf_state *state) return -1; } + if ((error = ptrbox_init(&state->ptrbox)) < 0) { + fclose(state->in_fp); + printf("fatal: failed to create pointer box\n"); + return error; + } + state->lex_cache = '\0'; return 0; } @@ -32,4 +40,5 @@ defconf_state_destroy(struct defconf_state *state) fclose(state->in_fp); state->in_fp = NULL; + ptrbox_destroy(&state->ptrbox); } -- cgit v1.2.3