home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume20 / gperf / part01 / cperf / src / xmalloc.c < prev   
Encoding:
C/C++ Source or Header  |  1989-10-18  |  1.0 KB  |  38 lines

  1. /* Provide a useful malloc sanity checker....
  2.    Copyright (C) 1989 Free Software Foundation, Inc.
  3.    written by Douglas C. Schmidt (schmidt@ics.uci.edu)
  4.  
  5. This file is part of GNU GPERF.
  6.  
  7. GNU GPERF is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 1, or (at your option)
  10. any later version.
  11.  
  12. GNU GPERF is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with GNU GPERF; see the file COPYING.  If not, write to
  19. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21. #include <stdio.h>
  22.  
  23. char *
  24. xmalloc (size)
  25.      int size;
  26. {
  27.   char *malloc ();
  28.   char *temp = malloc (size);
  29.   
  30.   if (temp == 0)
  31.     {
  32.       fprintf (stderr, "out of virtual memory\n");
  33.       exit (1);
  34.     }
  35.   return temp;
  36. }
  37.  
  38.