src/cx/allocator.h

changeset 405
44efaa54d63d
parent 397
cfc1193b1e65
child 414
81a4c3a63e65
equal deleted inserted replaced
404:86ebc3745e62 405:44efaa54d63d
29 #ifndef UCX_ALLOCATOR_H 29 #ifndef UCX_ALLOCATOR_H
30 #define UCX_ALLOCATOR_H 30 #define UCX_ALLOCATOR_H
31 31
32 #include <stdlib.h> 32 #include <stdlib.h>
33 33
34 typedef void *(*cx_malloc_func)(void *data, size_t n);
35
36 typedef void *(*cx_realloc_func)(void *data, void *mem, size_t n);
37
38 typedef void *(*cx_calloc_func)(void *data, size_t nelem, size_t n);
39
40 typedef void(*cx_free_func)(void *data, void *mem);
41
42 typedef struct { 34 typedef struct {
43 cx_malloc_func malloc; 35 void *(*malloc)(void *data, size_t n);
44 cx_realloc_func realloc; 36 void *(*realloc)(void *data, void *mem, size_t n);
45 cx_calloc_func calloc; 37 void *(*calloc)(void *data, size_t nelem, size_t n);
46 cx_free_func free; 38 void(*free)(void *data, void *mem);
47 } cx_allocator_class; 39 } cx_allocator_class;
48 40
49 extern cx_allocator_class cx_default_allocator_class; 41 extern cx_allocator_class cx_default_allocator_class;
50 42
51 struct cx_allocator_s { 43 struct cx_allocator_s {

mercurial