summaryrefslogtreecommitdiff
path: root/lib/util/util.c
blob: dd068697419276759edb08df9757a395cf8b81ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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;
}