From 5a20b409c673a6736c3f9326cb54edc32908f717 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Tue, 20 Oct 2015 22:51:57 +0200 Subject: add sbase-style ecalloc(), calloc: or die ... remove intermediary variables --- util.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'util.c') 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; -- cgit v1.2.3-70-g09d2