diff options
-rw-r--r-- | util.c | 23 |
1 files changed, 12 insertions, 11 deletions
@@ -6,18 +6,9 @@ | |||
6 | 6 | ||
7 | #include "util.h" | 7 | #include "util.h" |
8 | 8 | ||
9 | void * | ||
10 | ecalloc(size_t nmemb, size_t size) | ||
11 | { | ||
12 | void *p; | ||
13 | |||
14 | if (!(p = calloc(nmemb, size))) | ||
15 | die("calloc:"); | ||
16 | return p; | ||
17 | } | ||
18 | |||
19 | void | 9 | void |
20 | die(const char *fmt, ...) { | 10 | die(const char *fmt, ...) |
11 | { | ||
21 | va_list ap; | 12 | va_list ap; |
22 | 13 | ||
23 | va_start(ap, fmt); | 14 | va_start(ap, fmt); |
@@ -33,3 +24,13 @@ die(const char *fmt, ...) { | |||
33 | 24 | ||
34 | exit(1); | 25 | exit(1); |
35 | } | 26 | } |
27 | |||
28 | void * | ||
29 | ecalloc(size_t nmemb, size_t size) | ||
30 | { | ||
31 | void *p; | ||
32 | |||
33 | if (!(p = calloc(nmemb, size))) | ||
34 | die("calloc:"); | ||
35 | return p; | ||
36 | } | ||