diff options
author | Preston Pan <ret2pop@gmail.com> | 2024-12-27 20:05:06 -0800 |
---|---|---|
committer | Preston Pan <ret2pop@gmail.com> | 2024-12-27 20:05:06 -0800 |
commit | 63f11aaec8d21844a07fd27003a992c102a3a297 (patch) | |
tree | 6240a2c8561642d0c1d0b95148d6c868c7855a4a /src/helpers.c | |
parent | fd14f6fbf8206589d2a0ad8f0793845cb8faf1d7 (diff) |
make directory structure for client
Diffstat (limited to 'src/helpers.c')
-rw-r--r-- | src/helpers.c | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/src/helpers.c b/src/helpers.c deleted file mode 100644 index 8485dc6..0000000 --- a/src/helpers.c +++ /dev/null @@ -1,34 +0,0 @@ -#include <helpers.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -void die_lz(int code, const char *msg) { - if (code < 0) { - die(msg); - } -} - -void die(const char *msg) { - fprintf(stderr, "panic: "); - perror(msg); - exit(EXIT_FAILURE); -} - -void *safe_calloc(unsigned int i, size_t size) { - void *x = calloc(i, size); - if (x == NULL) { - die("abort: calloc()"); - } - return x; -} - -void *safe_realloc(void *x, size_t size) { - void *p = realloc(x, size); - if (x == NULL) { - die("abort: realloc()"); - } - return p; -} - -void alloc_zero(void *ptr, size_t size) { memset(ptr, 0, size); } |