ucx/allocator.h

Fri, 12 Oct 2012 10:54:55 +0200

author
Mike Becker <universe@uap-core.de>
date
Fri, 12 Oct 2012 10:54:55 +0200
changeset 69
fb59270b1de3
parent 52
34f50d0bada4
child 103
08018864fb91
permissions
-rw-r--r--

made the code work with VC++ compiler (use make CONF=windows)

     1 #ifndef ALLOCATOR_H
     2 #define	ALLOCATOR_H
     4 #include "ucx.h"
     6 #ifdef	__cplusplus
     7 extern "C" {
     8 #endif
    10 typedef void*(*ucx_allocator_malloc)(void *pool, size_t n);
    11 typedef void*(*ucx_allocator_calloc)(void *pool, size_t n, size_t size);
    12 typedef void*(*ucx_allocator_realloc)(void *pool, void *data, size_t n);
    14 typedef struct {
    15     void *pool;
    16     ucx_allocator_malloc malloc;
    17     ucx_allocator_calloc calloc;
    18     ucx_allocator_realloc realloc;
    19 } UcxAllocator;
    21 void *ucx_default_malloc(void *ignore, size_t n);
    22 void *ucx_default_calloc(void *ignore, size_t n, size_t size);
    23 void *ucx_default_realloc(void *ignore, void *data, size_t n);
    25 #define UCX_ALLOCATOR_DEFAULT {NULL, \
    26         ucx_default_malloc, ucx_default_calloc, ucx_default_realloc}
    28 #ifdef	__cplusplus
    29 }
    30 #endif
    32 #endif	/* ALLOCATOR_H */

mercurial