/*
 * $Id: privateallocvec.c 1.5 1998/04/12 17:29:49 olsen Exp olsen $
 *
 * :ts=4
 *
 * Wipeout -- Traces and munges memory and detects memory trashing
 *
 * Written by Olaf `Olsen' Barthel <olsen@sourcery.han.de>
 * Public Domain
 */

#ifndef _GLOBAL_H
#include "global.h"
#endif	/* _GLOBAL_H */

/******************************************************************************/

#include "installpatches.h"

/******************************************************************************/

APTR
PrivateAllocVec(ULONG byteSize,ULONG attributes)
{
	APTR result;

	/* allocate memory through AllocVec(); but if AllocVec()
	 * has been redirected to our code, we still want to use
	 * the original ROM routine
	 */

	if(OldAllocVec != NULL)
	{
		result = (*OldAllocVec)(byteSize,attributes,SysBase);
	}
	else
	{
		result = AllocVec(byteSize,attributes);
	}

	return(result);
}

VOID
PrivateFreeVec(APTR memoryBlock)
{
	/* free memory allocated by AllocVec(); but if FreeVec()
	 * has been redirected to our code, we still want to use
	 * the original ROM routine
	 */

	if(OldFreeVec != NULL)
	{
		(*OldFreeVec)(memoryBlock,SysBase);
	}
	else
	{
		FreeVec(memoryBlock);
	}
}
