#include #include #include "vogle.h" /******************************************************************************/ /* * Though declared as "void", this should return a pointer */ void *vallocate(size_t num_bytes,char* from){ /* malloc with error checking */ void *temp; char buf[60]; /* fprintf(stderr,"VALLOCATE %d %s\n",num_bytes,from); */ temp = malloc( num_bytes ); if( temp == NULL ) { perror( "malloc: " ); sprintf(buf,"*vallocate*: request for %ld bytes returned NULL", (long int)num_bytes); verror(buf); exit( -1 ); } return temp; } /******************************************************************************/ void vfree(void *APRT,char* from ){ /* realloc with error checking */ int status=0; char buf[80]; /* fprintf(stderr," VFREE %s\n",from); */ /* MINGW exits if status == 0 */ if( (status=(int)realloc(APRT,(size_t)0)) == NULL && status != 0) { perror( "realloc: " ); sprintf(buf,"*vfree*: request for freeing memory via realloc failed with %d %s",status,from); verror(buf); exit( -1 ); } } /******************************************************************************/