add sbase-style ecalloc(), calloc: or die

... remove intermediary variables
This commit is contained in:
Hiltjo Posthuma
2015-10-20 22:51:57 +02:00
parent 164986763a
commit 5a20b409c6
3 changed files with 18 additions and 12 deletions

10
util.c
View File

@ -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;