From ef9ab1fd141f4057d41f2d6ed8ab8d67c44894d5 Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Thu, 9 Jan 2025 16:32:55 -0800 Subject: save state --- src/common/helpers.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/common/helpers.c') diff --git a/src/common/helpers.c b/src/common/helpers.c index 4bf7301..4a3606a 100644 --- a/src/common/helpers.c +++ b/src/common/helpers.c @@ -4,9 +4,8 @@ #include void die_lz(int code, const char *msg) { - if (code < 0) { + if (code < 0) die(msg); - } } void die(const char *msg) { @@ -17,17 +16,19 @@ void die(const char *msg) { void *safe_calloc(unsigned int i, size_t size) { void *x = calloc(i, size); - if (x == NULL) { + + if (x == NULL) die("abort: calloc()"); - } + return x; } void *safe_realloc(void *x, size_t size) { void *p = realloc(x, size); - if (x == NULL) { + + if (x == NULL) die("abort: realloc()"); - } + return p; } -- cgit