src/server/ucx/allocator.h

Tue, 01 Jan 2013 19:22:56 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Tue, 01 Jan 2013 19:22:56 +0100
changeset 44
3da1f7b6847f
parent 36
450d2d5f4735
child 71
069c152f6272
permissions
-rw-r--r--

added some error messages

36
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 #ifndef ALLOCATOR_H
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 #define ALLOCATOR_H
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 #ifdef __cplusplus
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 extern "C" {
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 #endif
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 typedef void*(*ucx_allocator_malloc)(void *pool, size_t n);
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 typedef void*(*ucx_allocator_calloc)(void *pool, size_t n, size_t size);
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 typedef void*(*ucx_allocator_realloc)(void *pool, void *data, size_t n);
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 typedef struct {
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 void *pool;
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 ucx_allocator_malloc malloc;
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 ucx_allocator_calloc calloc;
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 ucx_allocator_realloc realloc;
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 } UcxAllocator;
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 void *ucx_default_malloc(void *ignore, size_t n);
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 void *ucx_default_calloc(void *ignore, size_t n, size_t size);
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 void *ucx_default_realloc(void *ignore, void *data, size_t n);
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 #define UCX_ALLOCATOR_DEFAULT {NULL, \
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 ucx_default_malloc, ucx_default_calloc, ucx_default_realloc}
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 #ifdef __cplusplus
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 }
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28 #endif
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 #endif /* ALLOCATOR_H */
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31

mercurial