aboutsummaryrefslogtreecommitdiffstats
path: root/envmalloczn.c
diff options
context:
space:
mode:
Diffstat (limited to 'envmalloczn.c')
-rw-r--r--envmalloczn.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/envmalloczn.c b/envmalloczn.c
new file mode 100644
index 0000000..27c6c0b
--- /dev/null
+++ b/envmalloczn.c
@@ -0,0 +1,17 @@
+/* See LICENSE file for copyright and license details. */
+#include "libsimple.h"
+
+
+extern char *argv0;
+
+
+void *
+libsimple_envmalloczn(int status, int clear, size_t n, va_list ap)
+{
+ void *ret = libsimple_vmalloczn(clear, n, ap);
+ if (!ret) {
+ fprintf(stderr, "%s: %s: %s\n", argv0, clear ? "calloc" : "malloc", strerror(errno));
+ exit(status);
+ }
+ return ret;
+}