#include "rvp.h" /* safe malloc */ void *xmalloc(size_t x) { void *r; if((r = malloc(x))) { memset(r, 0, x); return r; } fprintf(stderr, "out of memory.\n"); exit(-1); /* NOTREACHED */ return NULL; } /* safe realloc */ void *xrealloc(void *p, size_t x) { void *r; if((r = realloc(p, x))) return r; fprintf(stderr, "out of memory.\n"); exit(-1); /* NOTREACHED */ return NULL; }