From 1fd84c7dc70a0a6e6d8651fafa50c51dd697ae77 Mon Sep 17 00:00:00 2001 From: Benedict Date: Thu, 2 Feb 2017 00:32:26 +0100 Subject: added random stuff which hasn't beend added because yeah --- lib/util/util.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 lib/util/util.c (limited to 'lib/util/util.c') diff --git a/lib/util/util.c b/lib/util/util.c new file mode 100644 index 0000000..dd06869 --- /dev/null +++ b/lib/util/util.c @@ -0,0 +1,25 @@ +#include "util.h" + +void *die(char *text) +{ + printf("dieing: %s\n", text); + exit(1); +} + +void *xmalloc(unsigned int size) +{ + void *mem = malloc(size); + if(mem == NULL) + die("out of memory"); + else + return mem; +} + +void *xrealloc(void *data, unsigned int size) +{ + void *mem = realloc(data, size); + if(mem == NULL) + die("out of memory"); + else + return mem; +} -- cgit v1.2.3-70-g09d2