summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2015-10-20 22:51:57 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2015-10-20 22:51:57 +0200
commit5a20b409c673a6736c3f9326cb54edc32908f717 (patch)
tree9b30985369ab49bd7588127411d9cf2209f19efb /util.c
parent164986763a29db97abb52b15cbd282b5636d83c0 (diff)
add sbase-style ecalloc(), calloc: or die
... remove intermediary variables
Diffstat (limited to 'util.c')
-rw-r--r--util.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/util.c b/util.c
index 9b27512..6b703e9 100644
--- a/util.c
+++ b/util.c
@@ -6,6 +6,16 @@
#include "util.h"
+void *
+ecalloc(size_t nmemb, size_t size)
+{
+ void *p;
+
+ if (!(p = calloc(nmemb, size)))
+ perror(NULL);
+ return p;
+}
+
void
die(const char *fmt, ...) {
va_list ap;