diff options
| -rw-r--r-- | mem.c | 16 | ||||
| -rw-r--r-- | mem.h | 8 |
2 files changed, 24 insertions, 0 deletions
@@ -0,0 +1,16 @@ +#include "mem.h" + +#include <curses.h> +#include <stddef.h> +#include <stdlib.h> + +#include "err.h" + +void *xmalloc(size_t size) { + void *rtn = malloc(size); + if (!rtn) { + endwin(); + die("Out of memory"); + } + return rtn; +} @@ -0,0 +1,8 @@ +#ifndef SS_MEM_H +#define SS_MEM_H + +#include <stddef.h> + +void* xmalloc(size_t size); + +#endif /* SS_MEM_H */ |
