aboutsummaryrefslogtreecommitdiffstats
path: root/mem.c
diff options
context:
space:
mode:
authorverdant <im@verdant.ee>2026-07-21 18:54:26 +0800
committerverdant <im@verdant.ee>2026-07-21 18:54:26 +0800
commitfe0b140cf436c1428baa371b809370903df9f47b (patch)
tree83e58aee8ca084bccb487a34ebc23c33e23fe5f4 /mem.c
parent3e4e10c1c1203d605aeceafa8f15e6a3a4aa8033 (diff)
downloadsf-fe0b140cf436c1428baa371b809370903df9f47b.tar.gz
sf-fe0b140cf436c1428baa371b809370903df9f47b.zip
Add xmalloc
Diffstat (limited to 'mem.c')
-rw-r--r--mem.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/mem.c b/mem.c
new file mode 100644
index 0000000..ff76b08
--- /dev/null
+++ b/mem.c
@@ -0,0 +1,16 @@
+#include "mem.h"
+
+#include <curses.h>
+#include <stddef.h>
+#include <stdlib.h>
+
+#include "err.h"
+
+void *xmalloc(size_t size) {
+ void *rtn = malloc(size);
+ if (!rtn) {
+ endwin();
+ die("Out of memory");
+ }
+ return rtn;
+}