home *** CD-ROM | disk | FTP | other *** search
/ gondwana.ecr.mu.oz.au/pub/ / Graphics.tar / Graphics / atomart.tar.gz / atomart.tar / smalloc.c < prev    next >
C/C++ Source or Header  |  1990-06-14  |  327b  |  24 lines

  1. #include <stdio.h>
  2.  
  3. extern char    *malloc();
  4.  
  5. /*
  6.  * smalloc
  7.  *
  8.  *    allocates memory - checking for null
  9.  */
  10. char *
  11. smalloc(size)
  12.     unsigned    size;
  13. {
  14.     char    *p, buf[BUFSIZ];
  15.  
  16.     if ((p = malloc(size)) == (char *)NULL) {
  17.         sprintf(buf, "smalloc: request for %d bytes from malloc returns NULL.\n", size);
  18.         fatal(buf);
  19.     }
  20.  
  21.     return(p);
  22. }
  23.  
  24.