core: Initialize per-state pointer box
Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user