 /*
  * these routines will use pooled memory under V39 or higher or standard
  * memory routines when running under earlier versions of the OS.  We lock
  * semaphores as a means to prevent multiple people from stomping on the
  * pool handles concurrently.
  */

extern APTR pool;

static void *__inline MyAllocVec(ULONG size)
{
	UBYTE *memory;

	size += sizeof(ULONG);

	memory = AllocPooled(pool, size);

	if (!memory)
		return NULL;

	*((ULONG *) memory) = size;

	return (void *)(memory + sizeof(ULONG));
}

static void __inline MyFreeVec(void *memory)
{
	void *realMemory;
	ULONG size;

	if (!memory)
		return;

	realMemory = (UBYTE *) memory - sizeof(ULONG);
	size = *((ULONG *) realMemory);

	FreePooled(pool, realMemory, size);
}
