home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #1 / MONSTER.ISO / prog / gen / regex011.taz / regex011 / regex-0.11 / test / xmalloc.c < prev   
Encoding:
C/C++ Source or Header  |  1992-09-16  |  303 b   |  22 lines

  1. #include <stdio.h>
  2. extern char *malloc ();
  3.  
  4. #ifndef NULL
  5. #define NULL 0
  6. #endif
  7.  
  8. void *
  9. xmalloc (size)
  10.   unsigned size;
  11. {
  12.   char *new_mem = malloc (size); 
  13.   
  14.   if (new_mem == NULL)
  15.     {
  16.       fprintf (stderr, "xmalloc: request for %u bytes failed.\n", size);
  17.       abort ();
  18.     }
  19.  
  20.   return new_mem;
  21. }
  22.