3 @brief ENet callback functions
5 #define ENET_BUILDING_LIB 1
8 static ENetCallbacks callbacks
= { malloc
, free
, rand
};
11 enet_initialize_with_callbacks (ENetVersion version
, const ENetCallbacks
* inits
)
13 if (version
!= ENET_VERSION
)
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
-> rand
!= NULL
)
26 callbacks
.rand
= inits
-> rand
;
28 return enet_initialize ();
32 enet_malloc (size_t size
)
34 void * memory
= callbacks
.malloc (size
);
43 enet_free (void * memory
)
45 callbacks
.free (memory
);
51 return callbacks
.rand ();