csgo-2018-source/thirdparty/quickhull/qhMemory.cpp
2021-07-24 21:11:47 -07:00

50 lines
1.5 KiB
C++

//--------------------------------------------------------------------------------------------------
// qhMemory.cpp
//
// Copyright(C) 2011 by D. Gregorius. All rights reserved.
//--------------------------------------------------------------------------------------------------
#include "qhMemory.h"
#include "qhTypes.h"
#include <stdlib.h>
//--------------------------------------------------------------------------------------------------
// Local utilities
//--------------------------------------------------------------------------------------------------
static void* qhDefaultAlloc( size_t Bytes )
{
return malloc( Bytes );
}
//--------------------------------------------------------------------------------------------------
static void qhDefaultFree( void* Address )
{
return free( Address );
}
//--------------------------------------------------------------------------------------------------
// qhMemory
//--------------------------------------------------------------------------------------------------
void* (*qhAllocHook)( size_t ) = qhDefaultAlloc;
void (*qhFreeHook)( void* ) = qhDefaultFree;
//--------------------------------------------------------------------------------------------------
void* qhAlloc( size_t Bytes )
{
QH_ASSERT( qhAllocHook != NULL );
return qhAllocHook( Bytes );
}
//--------------------------------------------------------------------------------------------------
void qhFree( void* Address )
{
QH_ASSERT( qhFreeHook != NULL );
qhFreeHook( Address );
}