3
@brief ENet callback functions
5
#define ENET_BUILDING_LIB 1
8
static ENetCallbacks callbacks = { malloc, free, abort };
11
enet_initialize_with_callbacks (ENetVersion version, const ENetCallbacks * inits)
13
if (version < ENET_VERSION_CREATE (1, 3, 0))
16
if (inits -> malloc != NULL || inits -> free != NULL)
18
if (inits -> malloc == NULL || inits -> free == NULL)
21
callbacks.malloc = inits -> malloc;
22
callbacks.free = inits -> free;
25
if (inits -> no_memory != NULL)
26
callbacks.no_memory = inits -> no_memory;
28
return enet_initialize ();
32
enet_malloc (size_t size)
34
void * memory = callbacks.malloc (size);
37
callbacks.no_memory ();
43
enet_free (void * memory)
45
callbacks.free (memory);