aboutsummaryrefslogtreecommitdiff
path: root/src/wrapper.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wrapper.c')
-rw-r--r--src/wrapper.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/wrapper.c b/src/wrapper.c
new file mode 100644
index 0000000..16c6300
--- /dev/null
+++ b/src/wrapper.c
@@ -0,0 +1,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;
+}