summaryrefslogtreecommitdiff
path: root/core/state.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/state.c')
-rw-r--r--core/state.c9
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);
}