home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume14 / bsd-dyna-link / smalloc.c < prev    next >
Text File  |  1988-05-08  |  261b  |  20 lines

  1. static char error[] = "Out of memory\n";
  2.  
  3. int*
  4. smalloc(size) /* "Safe" alloc */
  5. {  int* retval = (int*)calloc(1,size);
  6.  
  7.    if (retval == 0)
  8.     { write(2, error, sizeof(error));
  9.       exit(-1);
  10.     }
  11.    else return retval;
  12. }
  13.  
  14.  
  15.  
  16. sfree(ptr)
  17. {
  18.   if (ptr != 0) free(ptr);
  19. }
  20.