diff options
| author | Chloe M. <chloe@aptel.org> | 2026-08-23 05:40:51 +0000 |
|---|---|---|
| committer | Chloe M. <chloe@aptel.org> | 2026-08-23 05:40:51 +0000 |
| commit | 6153bf6edb45e4ad1759e3db69e3a7358ae28b4e (patch) | |
| tree | c6cad42382502e7f3a9cc840b6df12480d07f1ef /core/state.c | |
| parent | 78b925a4d86b57e58e6322b7cad7bc47098618fd (diff) | |
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. <chloe@aptel.org>
Diffstat (limited to 'core/state.c')
| -rw-r--r-- | core/state.c | 9 |
1 files changed, 9 insertions, 0 deletions
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); } |
