diff options
| author | Ian M. <ian@aptel.org> | 2026-10-04 22:00:12 +0000 |
|---|---|---|
| committer | Ian M. <ian@aptel.org> | 2026-10-04 22:00:32 +0000 |
| commit | 5af35efce67446c47c4816013cd06474631decad (patch) | |
| tree | bbb50e54428a8a3a7511f1f4a7c39e48dbce7024 /core | |
| parent | 7f21fd6b283a6b2f43b21b3d7ec7235ddb651ad5 (diff) | |
state: Add atas_fatal() to terminate execution
Signed-off-by: Ian M. <ian@aptel.org>
Diffstat (limited to 'core')
| -rw-r--r-- | core/state.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/core/state.c b/core/state.c index 8c3dea1..eaca878 100644 --- a/core/state.c +++ b/core/state.c @@ -4,7 +4,9 @@ */ #include <atas/state.h> +#include <stdlib.h> #include <errno.h> +#include <assert.h> int atas_state_init(const char *in_file, struct atas_state *state) @@ -32,3 +34,11 @@ atas_state_destroy(struct atas_state *state) fclose(state->in_file); state->in_file = NULL; } + +void +atas_fatal(struct atas_state *state) +{ + assert(state != NULL && "state cannot be NULL\n"); + atas_state_destroy(state); + exit(1); +} |
