Commit | Line | Data |
---|---|---|
1 | #include <malloc.h> | |
2 | #include <stdlib.h> | |
3 | ||
4 | #include "debug.h" | |
5 | ||
6 | #include "alloc.h" | |
7 | ||
8 | /* calloc or die function */ | |
9 | ||
10 | void *callocordie (size_t count, size_t size) | |
11 | { | |
12 | if (count * size == 0) { | |
13 | return NULL; | |
14 | } | |
15 | void *new = calloc (count, size); | |
16 | if (new == NULL) { | |
17 | VERBOSE (ERROR, fprintf (stderr, "can't allocate memory\n")); | |
18 | exit (1); | |
19 | } | |
20 | return new; | |
21 | } | |
22 | ||
23 | /* vim: set ts=4 sw=4 et: */ |