lib/cfg_parse.c
/* Helper functions
    A malloc() wrapper which handles null return values, and zeroes memory too */
Helper functions
A malloc() wrapper which handles null return values, and zeroes memory too
Helper functions A malloc () wrapper which handles null return values and zeroes memory too
static void *cfg_malloc(const unsigned int size)
{
  void *temp = malloc(size);
  if (temp == NULL && size != 0)
  {
    fprintf(stderr,"CFG_PARSE ERROR: MALLOC(%u) returned NULL (errno==",size);
    if (errno == ENOMEM)
      fprintf(stderr, "ENOMEM");
    else
      fprintf(stderr, "%d, ENOMEM==%d",errno,ENOMEM);
    fprintf(stderr,")\n");
    exit(EXIT_FAILURE);
  }
  memset(temp,0,size);
  return temp;
}
static void * cfg_malloc ( const unsigned int size ) { void * temp = malloc ( size ) ; if ( temp == NULL && size != 0 ) { fprintf ( stderr , " " , size ) ; if ( errno == ENOMEM ) fprintf ( stderr , " " ) ; else fprintf ( stderr , " " , errno , ENOMEM ) ; fprintf ( stderr , " \n " ) ; exit ( EXIT_FAILURE ) ; } memset ( temp , 0 , size ) ; return temp ; }
Helper functions
A malloc() wrapper which handles null return values, and zeroes memory too
Helper functions A malloc () wrapper which handles null return values and zeroes memory too