ref: ee794d139ff0a24625e5a3be51cbe88f0357d5f9
parent: 6829cc1c0e7afd92f901665ec7e79e1257de8b96
author: mkf <mkf@cloud9p.org>
date: Tue May 14 04:01:23 EDT 2024
util.[ch]: add emalloc
--- a/util.c
+++ b/util.c
@@ -108,4 +108,16 @@
n = vfprint(2, fmt, va);
va_end(va);
return n;
-}
\ No newline at end of file
+}
+
+void*
+emalloc(unsigned long n)
+{
+ void *p;
+
+ p = malloc(n);
+ if(p == nil)
+ sysfatal("mallocz: %r");
+
+ return p;
+}
--- a/util.h
+++ b/util.h
@@ -3,3 +3,4 @@
char* dirtostr(int dir);
Point parseput(char *x, char *y);
int dprint(char *fmt, ...);
+void* emalloc(unsigned long n);
\ No newline at end of file