core: Initialize per-state pointer box

Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
2026-03-21 10:15:46 -04:00
parent 12fb91b467
commit 0dc25fe685
2 changed files with 9 additions and 0 deletions

View File

@@ -32,6 +32,11 @@ quip_state_init(const char *build_file, struct quip_state *state)
return -1;
}
if (ptrbox_init(&state->ptrbox) < 0) {
close(state->in_fd);
return -1;
}
return 0;
}
@@ -42,6 +47,7 @@ quip_state_destroy(struct quip_state *state)
return;
}
ptrbox_destroy(&state->ptrbox);
close(state->in_fd);
state->in_fd = -1;
}

View File

@@ -14,6 +14,7 @@
#include <stdint.h>
#include <stddef.h>
#include "common/knobs.h"
#include "common/ptrbox.h"
/*
* Represents the build state machine
@@ -24,6 +25,7 @@
* @lex_buf_cap: Lexer buffer capacity
* @lex_buf_i: Lexer buffer index
* @lex_putback: Lexer putback buffer
* @ptrbox: Global pointer box
*/
struct quip_state {
int in_fd;
@@ -32,6 +34,7 @@ struct quip_state {
size_t lex_buf_cap;
size_t lex_buf_i;
char lex_putback;
struct ptrbox ptrbox;
};
/*