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

Functions

static void * rcAllocDefault (int size, rcAllocHint)
 
static void rcFreeDefault (void *ptr)
 
void rcAllocSetCustom (rcAllocFunc *allocFunc, rcFreeFunc *freeFunc)
 
void * rcAlloc (int size, rcAllocHint hint)
 
void rcFree (void *ptr)
 

Variables

static rcAllocFuncsRecastAllocFunc = rcAllocDefault
 
static rcFreeFuncsRecastFreeFunc = rcFreeDefault
 

Function Documentation

void* rcAlloc ( int  size,
rcAllocHint  hint 
)
See also
rcAllocSetCustom
45 {
46  return sRecastAllocFunc(size, hint);
47 }
static rcAllocFunc * sRecastAllocFunc
Definition: RecastAlloc.cpp:33

+ Here is the caller graph for this function:

static void* rcAllocDefault ( int  size,
rcAllocHint   
)
static
24 {
25  return malloc(size);
26 }

+ Here is the caller graph for this function:

void rcAllocSetCustom ( rcAllocFunc allocFunc,
rcFreeFunc freeFunc 
)
See also
rcAlloc, rcFree
38 {
39  sRecastAllocFunc = allocFunc ? allocFunc : rcAllocDefault;
40  sRecastFreeFunc = freeFunc ? freeFunc : rcFreeDefault;
41 }
static rcFreeFunc * sRecastFreeFunc
Definition: RecastAlloc.cpp:34
static void rcFreeDefault(void *ptr)
Definition: RecastAlloc.cpp:28
static void * rcAllocDefault(int size, rcAllocHint)
Definition: RecastAlloc.cpp:23
static rcAllocFunc * sRecastAllocFunc
Definition: RecastAlloc.cpp:33

+ Here is the call graph for this function:

void rcFree ( void *  ptr)
Warning
This function leaves the value of ptr unchanged. So it still points to the same (now invalid) location, and not to null.
See also
rcAllocSetCustom
56 {
57  if (ptr)
58  sRecastFreeFunc(ptr);
59 }
static rcFreeFunc * sRecastFreeFunc
Definition: RecastAlloc.cpp:34

+ Here is the caller graph for this function:

static void rcFreeDefault ( void *  ptr)
static
29 {
30  free(ptr);
31 }

+ Here is the caller graph for this function:

Variable Documentation

rcAllocFunc* sRecastAllocFunc = rcAllocDefault
static
rcFreeFunc* sRecastFreeFunc = rcFreeDefault
static