#include "shared.h" #include #include #include #include #include void* xcalloc(size_t nmemb, size_t size) { void *mem = calloc(nmemb, size); if(mem == NULL) { #if defined ___VXGG___XCALLOC_EXIT_ON_ERROR___ && ___VXGG___XCALLOC_EXIT_ON_ERROR___ > 0 error(1, errno, " Could not allocate memory"); #endif abort(); } return mem; } void* xreallocarray(void *ptr, size_t nmemb, size_t size) { void *mem = reallocarray(ptr, nmemb, size); if(mem == NULL) { #if defined ___VXGG___XCALLOC_EXIT_ON_ERROR___ && ___VXGG___XCALLOC_EXIT_ON_ERROR___ > 0 error(1, errno, " Could not allocate memory"); #endif abort(); } return mem; }