home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 28 / amigaformatcd28.iso / -seriously_amiga- / programming / other / wipeout / source / privateallocvec.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-27  |  1.1 KB  |  61 lines

  1. /*
  2.  * $Id: privateallocvec.c 1.5 1998/04/12 17:29:49 olsen Exp olsen $
  3.  *
  4.  * :ts=4
  5.  *
  6.  * Wipeout -- Traces and munges memory and detects memory trashing
  7.  *
  8.  * Written by Olaf `Olsen' Barthel <olsen@sourcery.han.de>
  9.  * Public Domain
  10.  */
  11.  
  12. #ifndef _GLOBAL_H
  13. #include "global.h"
  14. #endif    /* _GLOBAL_H */
  15.  
  16. /******************************************************************************/
  17.  
  18. #include "installpatches.h"
  19.  
  20. /******************************************************************************/
  21.  
  22. APTR
  23. PrivateAllocVec(ULONG byteSize,ULONG attributes)
  24. {
  25.     APTR result;
  26.  
  27.     /* allocate memory through AllocVec(); but if AllocVec()
  28.      * has been redirected to our code, we still want to use
  29.      * the original ROM routine
  30.      */
  31.  
  32.     if(OldAllocVec != NULL)
  33.     {
  34.         result = (*OldAllocVec)(byteSize,attributes,SysBase);
  35.     }
  36.     else
  37.     {
  38.         result = AllocVec(byteSize,attributes);
  39.     }
  40.  
  41.     return(result);
  42. }
  43.  
  44. VOID
  45. PrivateFreeVec(APTR memoryBlock)
  46. {
  47.     /* free memory allocated by AllocVec(); but if FreeVec()
  48.      * has been redirected to our code, we still want to use
  49.      * the original ROM routine
  50.      */
  51.  
  52.     if(OldFreeVec != NULL)
  53.     {
  54.         (*OldFreeVec)(memoryBlock,SysBase);
  55.     }
  56.     else
  57.     {
  58.         FreeVec(memoryBlock);
  59.     }
  60. }
  61.