blob: 811a285eb42cbeb49e2f48eeed018a144d22659b [file] [log] [blame]
#include <stdlib.h>
#include <stdio.h>
#include "util.h"
void oom(void)
{
fprintf(stderr, "Out of virtual memory\n");
exit(1);
}
void *xcalloc(size_t a, size_t b)
{
void *p = calloc(a, b);
if (!p)
oom();
return p;
}
void *xalloc(size_t sz)
{
void *p = calloc(sz, 1);
if (!p)
oom();
return p;
}
void err(const char *msg)
{
perror(msg);
exit(1);
}