summaryrefslogtreecommitdiffstats
path: root/mem.c
diff options
context:
space:
mode:
authorSadeep Madurange <sadeep@asciimx.com>2026-03-10 17:40:58 +0800
committerSadeep Madurange <sadeep@asciimx.com>2026-03-10 17:40:58 +0800
commite0500692be6a8775c0a3c83984fc48d445a5f1d8 (patch)
treeb669a7072d375acd72905edc2520f4fe87dfa364 /mem.c
parent0afd55f721a878ad1104f4343114355778eaa058 (diff)
downloadcvn-e0500692be6a8775c0a3c83984fc48d445a5f1d8.tar.gz
Move memory and stack to own files and sort before hash.
Diffstat (limited to 'mem.c')
-rw-r--r--mem.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/mem.c b/mem.c
new file mode 100644
index 0000000..c1b1216
--- /dev/null
+++ b/mem.c
@@ -0,0 +1,22 @@
+#include <err.h>
+#include <stdlib.h>
+
+#include "mem.h"
+
+void *_xmalloc(size_t s, const char *file, int line)
+{
+ void *p;
+
+ if (!(p = malloc(s)))
+ err(1, "%s:%d: malloc", file, line);
+ return p;
+}
+
+void *_xrealloc(void *ptr, size_t s, const char *file, int line)
+{
+ void *p;
+
+ if (!(p = realloc(ptr, s)))
+ err(1, "%s:%d: realloc", file, line);
+ return p;
+}