summaryrefslogtreecommitdiffhomepage
path: root/callbacks.c
diff options
context:
space:
mode:
Diffstat (limited to 'callbacks.c')
-rw-r--r--callbacks.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/callbacks.c b/callbacks.c
index a062694..f941282 100644
--- a/callbacks.c
+++ b/callbacks.c
@@ -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 ();
-}
-