TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
DetourAlloc.cpp File Reference
#include <stdlib.h>
#include "DetourAlloc.h"
+ Include dependency graph for DetourAlloc.cpp:

Functions

static void * dtAllocDefault (int size, dtAllocHint)
 
static void dtFreeDefault (void *ptr)
 
void dtAllocSetCustom (dtAllocFunc *allocFunc, dtFreeFunc *freeFunc)
 
void * dtAlloc (int size, dtAllocHint hint)
 
void dtFree (void *ptr)
 

Variables

static dtAllocFuncsAllocFunc = dtAllocDefault
 
static dtFreeFuncsFreeFunc = dtFreeDefault
 

Function Documentation

void* dtAlloc ( int  size,
dtAllocHint  hint 
)

Allocates a memory block.

Parameters
[in]sizeThe size, in bytes of memory, to allocate.
[in]hintA hint to the allocator on how long the memory is expected to be in use.
Returns
A pointer to the beginning of the allocated memory block, or null if the allocation failed.
See also
dtFree
42 {
43  return sAllocFunc(size, hint);
44 }
static dtAllocFunc * sAllocFunc
Definition: DetourAlloc.cpp:32

+ Here is the caller graph for this function:

static void* dtAllocDefault ( int  size,
dtAllocHint   
)
static
23 {
24  return malloc(size);
25 }

+ Here is the caller graph for this function:

void dtAllocSetCustom ( dtAllocFunc allocFunc,
dtFreeFunc freeFunc 
)

Sets the base custom allocation functions to be used by Detour.

Parameters
[in]allocFuncThe memory allocation function to be used by dtAlloc
[in]freeFuncThe memory de-allocation function to be used by dtFree
36 {
37  sAllocFunc = allocFunc ? allocFunc : dtAllocDefault;
38  sFreeFunc = freeFunc ? freeFunc : dtFreeDefault;
39 }
static void * dtAllocDefault(int size, dtAllocHint)
Definition: DetourAlloc.cpp:22
static void dtFreeDefault(void *ptr)
Definition: DetourAlloc.cpp:27
static dtAllocFunc * sAllocFunc
Definition: DetourAlloc.cpp:32
static dtFreeFunc * sFreeFunc
Definition: DetourAlloc.cpp:33

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void dtFree ( void *  ptr)

Deallocates a memory block.

Parameters
[in]ptrA pointer to a memory block previously allocated using dtAlloc.
See also
dtAlloc
47 {
48  if (ptr)
49  sFreeFunc(ptr);
50 }
static dtFreeFunc * sFreeFunc
Definition: DetourAlloc.cpp:33

+ Here is the caller graph for this function:

static void dtFreeDefault ( void *  ptr)
static
28 {
29  free(ptr);
30 }

+ Here is the caller graph for this function:

Variable Documentation

dtAllocFunc* sAllocFunc = dtAllocDefault
static
dtFreeFunc* sFreeFunc = dtFreeDefault
static