home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / MacWT 0.9 / wt Source / wtmem.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-10-10  |  1.2 KB  |  57 lines  |  [TEXT/CWIE]

  1. /*
  2. **  MacWT -- a 3d game engine for the Macintosh
  3. **  © 1995, Bill Hayden and Nikol Software
  4. **  Free for non-commercial use - address questions to the e-mail address below
  5. **
  6. **  Mail:           afn28988@freenet.ufl.edu (Bill Hayden)
  7. **    MacWT FTP site: ftp.circa.ufl.edu/pub/software/ufmug/mirrors/LocalSW/Hayden/
  8. **  WWW Page:       http://grove.ufl.edu:80/~nikolsw
  9. **
  10. **    All of the above addresses are due to changes sometime in 1996, so stay tuned
  11. **
  12. **  based on wt, by Chris Laurel
  13. **
  14. **  This program is distributed in the hope that it will be useful,
  15. **  but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  17. */
  18.  
  19.  
  20. #include <stdlib.h>
  21. #include "wt.h"
  22. #include "error.h"
  23. #include "wtmem.h"
  24.  
  25.  
  26. /* malloc or die . . . */
  27. void *wtmalloc(size_t size)
  28. {
  29.     void *New;
  30.  
  31.     if ((New = malloc(size)) == NULL)
  32.         fatal_error("could not allocate %x bytes", size);
  33.  
  34.     return New;
  35. }
  36.  
  37.  
  38. /* realloc or die . . . */
  39. void *wtrealloc(void *v, size_t size)
  40. {
  41.     void *New;
  42.  
  43.     if ((New = realloc(v, size)) == NULL)
  44.         fatal_error("could not reallocate %x bytes", size);
  45.  
  46.     return New;
  47. }
  48.  
  49.  
  50. void wtfree(void *v)
  51. {
  52.     if (v == NULL)
  53.         fatal_error("wtfree(NULL)");
  54.     else
  55.         free(v);
  56. }
  57.