core: Add pointer box / RAII impl

Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
2026-05-23 06:03:23 -04:00
parent 32635789dc
commit f99c1d678f
4 changed files with 212 additions and 0 deletions
+6
View File
@@ -33,6 +33,11 @@ state_init(struct cescal_state *state, const char *pathname)
return -1;
}
if (ptrbox_init(&state->ptrbox) < 0) {
close(state->in_fd);
return -1;
}
return 0;
}
@@ -41,4 +46,5 @@ state_close(struct cescal_state *state)
{
close(state->in_fd);
state->in_fd = -1;
ptrbox_destroy(&state->ptrbox);
}