summaryrefslogtreecommitdiff
path: root/lib/util/util.c
diff options
context:
space:
mode:
authorBenedict <benedict@0xb8000.de>2017-02-02 00:32:26 +0100
committerBenedict <benedict@0xb8000.de>2017-02-21 13:00:27 +0100
commit1fd84c7dc70a0a6e6d8651fafa50c51dd697ae77 (patch)
treeaf5de3c7952e071c8e27800c41d9f945fa86c9e7 /lib/util/util.c
parent9dcc7348ad53cab8fd9396699de0177bac6729d5 (diff)
added random stuff which hasn't beend added because yeah
Diffstat (limited to 'lib/util/util.c')
-rw-r--r--lib/util/util.c25
1 files changed, 25 insertions, 0 deletions
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;
+}