From 38ae3eaa140e3def9ad338bf86874b8cf0036149 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sat, 14 Feb 2026 20:40:08 -0500 Subject: [PATCH] core: Add state-wide pointer box field Signed-off-by: Ian Moffett --- core/state.c | 6 ++++++ inc/rifle/state.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/core/state.c b/core/state.c index f60518b..999db25 100644 --- a/core/state.c +++ b/core/state.c @@ -16,7 +16,13 @@ rifle_state_init(struct rifle_state *state, const char *in_path) return -1; } + if (ptrbox_init(&state->ptrbox) < 0) { + close(state->in_fd); + return -1; + } + if (tokbuf_init(&state->tokbuf) < 0) { + ptrbox_destroy(&state->ptrbox); close(state->in_fd); return -1; } diff --git a/inc/rifle/state.h b/inc/rifle/state.h index f59e24d..2395a65 100644 --- a/inc/rifle/state.h +++ b/inc/rifle/state.h @@ -4,6 +4,7 @@ #include #include #include "rifle/tokbuf.h" +#include "rifle/ptrbox.h" /* * Represents the compiler state @@ -13,6 +14,7 @@ * @pass_num: Current pass * @tokbuf: Global token buffer * @putback: Lexer-side putback buffer + * @ptrbox: Global pointer box */ struct rifle_state { int in_fd; @@ -20,6 +22,7 @@ struct rifle_state { size_t pass_num; struct tokbuf tokbuf; char putback; + struct ptrbox ptrbox; }; /*