1.3.0 import

This commit is contained in:
eihrul 2010-06-09 21:16:23 +00:00
parent 2d985dba91
commit 572636062e
14 changed files with 300 additions and 131 deletions

View file

@ -5,11 +5,14 @@
#define ENET_BUILDING_LIB 1
#include "enet/enet.h"
static ENetCallbacks callbacks = { malloc, free, rand, abort };
static ENetCallbacks callbacks = { malloc, free, abort };
int
enet_initialize_with_callbacks (ENetVersion version, const ENetCallbacks * inits)
{
if (version < ENET_VERSION_CREATE (1, 3, 0))
return -1;
if (inits -> malloc != NULL || inits -> free != NULL)
{
if (inits -> malloc == NULL || inits -> free == NULL)
@ -19,14 +22,8 @@ enet_initialize_with_callbacks (ENetVersion version, const ENetCallbacks * inits
callbacks.free = inits -> free;
}
if (inits -> rand != NULL)
callbacks.rand = inits -> rand;
if (version >= ENET_VERSION_CREATE (1, 2, 2))
{
if (inits -> no_memory != NULL)
callbacks.no_memory = inits -> no_memory;
}
if (inits -> no_memory != NULL)
callbacks.no_memory = inits -> no_memory;
return enet_initialize ();
}
@ -48,9 +45,3 @@ enet_free (void * memory)
callbacks.free (memory);
}
int
enet_rand (void)
{
return callbacks.rand ();
}