Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
  2. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  3. #include <stdlib.h>
  4. #include <io.h>
  5. #include <unistd.h>
  6.  
  7. static char msg[] = "Fatal: xrealloc would have returned NULL\r\n";
  8.  
  9. void * xrealloc(void *ptr, size_t _sz);
  10. void *
  11. xrealloc(void *ptr, size_t _sz)
  12. {
  13.   void *rv;
  14.  
  15.   if (ptr == 0)
  16.     rv = malloc(_sz?_sz:1);
  17.   else
  18.     rv = realloc(ptr, _sz?_sz:1);
  19.  
  20.   if (rv == 0)
  21.   {
  22.     __libclog_printf(msg);
  23.     _exit(1);
  24.   }
  25.   return rv;
  26. }
  27.