summaryrefslogtreecommitdiff
path: root/src/lib.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib.c b/src/lib.c
index 7f077ba..e6e691a 100644
--- a/src/lib.c
+++ b/src/lib.c
@@ -3,6 +3,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
__attribute__((__noreturn__))
static void die() {
@@ -36,6 +37,12 @@ void *xalloc(size_t amount) {
return res;
}
+void *xzalloc(size_t amount) {
+ void *res = xalloc(amount);
+ memset(res, 0, sizeof(amount));
+ return res;
+}
+
void *xrealloc(void *ptr, size_t amount) {
void *res = realloc(ptr, amount);
if (res == NULL)