wmii/libcext/emallocz.c

23 lines
365 B
C
Raw Normal View History

2005-11-18 18:54:58 +03:00
/*
2006-01-20 17:20:24 +03:00
* (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com>
2005-11-18 18:54:58 +03:00
* See LICENSE file for license details.
*/
#include <stdlib.h>
#include <stdio.h>
#include "cext.h"
2005-12-21 18:18:11 +03:00
void *
cext_emallocz(unsigned int size)
2005-11-18 18:54:58 +03:00
{
void *res = calloc(1, size);
2005-11-18 18:54:58 +03:00
if(!res) {
fprintf(stderr, "fatal: could not malloc() %d bytes\n",
(int) size);
exit(1);
}
return res;
2005-11-18 18:54:58 +03:00
}