aboutsummaryrefslogtreecommitdiff
path: root/src/wrapper.c
blob: 16c6300d25efc86c5bbee196f2abae081f814e22 (plain) (blame)
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
26
27
#include <err.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>

void *
xmalloc(size_t n)
{
	void *p = malloc(n);
	if (p == NULL)
		err(1, "malloc");
	return p;
}

void *
xrealloc(void *p, size_t n)
{
	if ((p = realloc(p, n)) == NULL)
		err(1, "realloc");
	return p;
}

bool
streq(const char *x, const char *y)
{
	return strcmp(x, y) == 0;
}