diff options
Diffstat (limited to 'src/util.c')
| -rw-r--r-- | src/util.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c new file mode 100644 index 0000000..11796ce --- /dev/null +++ b/src/util.c | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | #include <stdio.h> | ||
| 2 | #include <string.h> | ||
| 3 | #include <stdlib.h> | ||
| 4 | #include "util.h" | ||
| 5 | |||
| 6 | void* xmalloc(size_t size) | ||
| 7 | { | ||
| 8 | void *block = malloc(size); | ||
| 9 | if (!block) { | ||
| 10 | perror("malloc"); | ||
| 11 | exit(1); | ||
| 12 | } | ||
| 13 | memset(block, 0, size); | ||
| 14 | return block; | ||
| 15 | } | ||
