|
@ -6,18 +6,9 @@ |
|
|
|
|
|
|
|
|
#include "util.h" |
|
|
#include "util.h" |
|
|
|
|
|
|
|
|
void * |
|
|
|
|
|
ecalloc(size_t nmemb, size_t size) |
|
|
|
|
|
{ |
|
|
|
|
|
void *p; |
|
|
|
|
|
|
|
|
|
|
|
if (!(p = calloc(nmemb, size))) |
|
|
|
|
|
die("calloc:"); |
|
|
|
|
|
return p; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
void |
|
|
die(const char *fmt, ...) { |
|
|
|
|
|
|
|
|
die(const char *fmt, ...) |
|
|
|
|
|
{ |
|
|
va_list ap; |
|
|
va_list ap; |
|
|
|
|
|
|
|
|
va_start(ap, fmt); |
|
|
va_start(ap, fmt); |
|
@ -33,3 +24,13 @@ die(const char *fmt, ...) { |
|
|
|
|
|
|
|
|
exit(1); |
|
|
exit(1); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void * |
|
|
|
|
|
ecalloc(size_t nmemb, size_t size) |
|
|
|
|
|
{ |
|
|
|
|
|
void *p; |
|
|
|
|
|
|
|
|
|
|
|
if (!(p = calloc(nmemb, size))) |
|
|
|
|
|
die("calloc:"); |
|
|
|
|
|
return p; |
|
|
|
|
|
} |