aboutsummaryrefslogtreecommitdiff
path: root/src/common/helpers.c
diff options
context:
space:
mode:
authorPreston Pan <ret2pop@gmail.com>2025-01-09 16:32:55 -0800
committerPreston Pan <ret2pop@gmail.com>2025-01-09 16:32:55 -0800
commitef9ab1fd141f4057d41f2d6ed8ab8d67c44894d5 (patch)
treee4005b7a641303b021eb54c2aae5676b5f92a72d /src/common/helpers.c
parent1fd608288ee47c2c560817f12f14b21069fed2f6 (diff)
save stateHEADmain
Diffstat (limited to 'src/common/helpers.c')
-rw-r--r--src/common/helpers.c13
1 files changed, 7 insertions, 6 deletions
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 <string.h>
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;
}