aboutsummaryrefslogtreecommitdiff
path: root/src/lib9/mallocz.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib9/mallocz.c')
-rw-r--r--src/lib9/mallocz.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/lib9/mallocz.c b/src/lib9/mallocz.c
new file mode 100644
index 00000000..c6313008
--- /dev/null
+++ b/src/lib9/mallocz.c
@@ -0,0 +1,14 @@
+#include <unistd.h>
+#include <string.h>
+#include <lib9.h>
+
+void*
+mallocz(unsigned long n, int clr)
+{
+ void *v;
+
+ v = malloc(n);
+ if(clr && v)
+ memset(v, 0, n);
+ return v;
+}