From c4138503f9986e9afe032476daf033bd2d95b4d8 Mon Sep 17 00:00:00 2001 From: eihrul Date: Fri, 14 May 2010 02:04:42 +0000 Subject: added no_memory callback that allows overriding the default abort behavior --- include/enet/callbacks.h | 1 + include/enet/enet.h | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/enet/callbacks.h b/include/enet/callbacks.h index 0b9e693..b488ac7 100644 --- a/include/enet/callbacks.h +++ b/include/enet/callbacks.h @@ -12,6 +12,7 @@ typedef struct _ENetCallbacks void * (ENET_CALLBACK * malloc) (size_t size); void (ENET_CALLBACK * free) (void * memory); int (ENET_CALLBACK * rand) (void); + void (ENET_CALLBACK * no_memory) (void); } ENetCallbacks; /** @defgroup callbacks ENet internal callbacks diff --git a/include/enet/enet.h b/include/enet/enet.h index b139976..2ffcb3f 100644 --- a/include/enet/enet.h +++ b/include/enet/enet.h @@ -23,10 +23,13 @@ extern "C" #include "enet/list.h" #include "enet/callbacks.h" -typedef enum _ENetVersion -{ - ENET_VERSION = 1 -} ENetVersion; +#define ENET_VERSION_MAJOR 1 +#define ENET_VERSION_MINOR 2 +#define ENET_VERSION_PATCH 2 +#define ENET_VERSION_CREATE(major, minor, patch) (((major)<<16) | ((minor)<<8) | (patch)) +#define ENET_VERSION ENET_VERSION_CREATE(ENET_VERSION_MAJOR, ENET_VERSION_MINOR, ENET_VERSION_PATCH) + +typedef enet_uint32 ENetVersion; typedef enum _ENetSocketType { @@ -376,7 +379,7 @@ typedef struct _ENetEvent ENET_API int enet_initialize (void); /** - Initializes ENet globally and supplies user-overridden callbacks. Must be called prior to using any functions in ENet. Do not use enet_initialize() if you use this variant. + Initializes ENet globally and supplies user-overridden callbacks. Must be called prior to using any functions in ENet. Do not use enet_initialize() if you use this variant. Make sure the ENetCallbacks structure is zeroed out so that any additional callbacks added in future versions will be properly ignored. @param version the constant ENET_VERSION should be supplied so ENet knows which version of ENetCallbacks struct to use @param inits user-overriden callbacks where any NULL callbacks will use ENet's defaults -- cgit v1.2.3