ucx/allocator.h

Fri, 05 Oct 2012 16:59:14 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Fri, 05 Oct 2012 16:59:14 +0200
changeset 52
34f50d0bada4
parent 50
ff194559eb41
child 69
fb59270b1de3
permissions
-rw-r--r--

added ucx_map_copy and fixed ucx_map_rehash

     1 #ifndef ALLOCATOR_H
     2 #define	ALLOCATOR_H
     4 #ifdef	__cplusplus
     5 extern "C" {
     6 #endif
     8 typedef void*(*ucx_allocator_malloc)(void *pool, size_t n);
     9 typedef void*(*ucx_allocator_calloc)(void *pool, size_t n, size_t size);
    10 typedef void*(*ucx_allocator_realloc)(void *pool, void *data, size_t n);
    12 typedef struct {
    13     void *pool;
    14     ucx_allocator_malloc malloc;
    15     ucx_allocator_calloc calloc;
    16     ucx_allocator_realloc realloc;
    17 } UcxAllocator;
    19 void *ucx_default_malloc(void *ignore, size_t n);
    20 void *ucx_default_calloc(void *ignore, size_t n, size_t size);
    21 void *ucx_default_realloc(void *ignore, void *data, size_t n);
    23 #define UCX_ALLOCATOR_DEFAULT {NULL, \
    24         ucx_default_malloc, ucx_default_calloc, ucx_default_realloc}
    26 #ifdef	__cplusplus
    27 }
    28 #endif
    30 #endif	/* ALLOCATOR_H */

mercurial