home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1999 May / pcp151c.iso / misc / src / install / modutils / util / xrealloc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-01-06  |  1.2 KB  |  40 lines

  1. /* Misc utility functions.
  2.    Copyright 1996, 1997 Linux International.
  3.    Contributed by Richard Henderson <rth@tamu.edu>
  4.  
  5.    This file is part of the Linux modutils.
  6.  
  7.    This program is free software; you can redistribute it and/or modify it
  8.    under the terms of the GNU General Public License as published by the
  9.    Free Software Foundation; either version 2 of the License, or (at your
  10.    option) any later version.
  11.  
  12.    This program is distributed in the hope that it will be useful, but
  13.    WITHOUT ANY WARRANTY; without even the implied warranty of
  14.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.    General Public License for more details.
  16.  
  17.    You should have received a copy of the GNU General Public License
  18.    along with this program; if not, write to the Free Software Foundation,
  19.    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
  20.  
  21. #ident "$Id: xrealloc.c,v 1.1.1.1 1998/01/06 20:51:08 ewt Exp $"
  22.  
  23. #include <stdlib.h>
  24. #include "util.h"
  25.  
  26.  
  27. /*======================================================================*/
  28.  
  29. void *
  30. xrealloc(void *old, size_t size)
  31. {
  32.   void *ptr = realloc(old, size);
  33.   if (!ptr)
  34.     {
  35.       error("Out of memory");
  36.       exit(1);
  37.     }
  38.   return ptr;
  39. }
  40.