Updating tree for new function work in libhashkit.
[m6w6/libmemcached] / libmemcached / allocators.h
1 /* LibMemcached
2 * Copyright (C) 2010 Brian Aker
3 * All rights reserved.
4 *
5 * Use and distribution licensed under the BSD license. See
6 * the COPYING file in the parent directory for full text.
7 *
8 * Summary: work with user defined memory allocators
9 *
10 */
11
12 #ifndef __MEMCACHED_ALLOCATORS_H__
13 #define __MEMCACHED_ALLOCATORS_H__
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
19 LIBMEMCACHED_API
20 memcached_return_t memcached_set_memory_allocators(memcached_st *ptr,
21 memcached_malloc_fn mem_malloc,
22 memcached_free_fn mem_free,
23 memcached_realloc_fn mem_realloc,
24 memcached_calloc_fn mem_calloc,
25 void *context);
26
27 LIBMEMCACHED_API
28 void memcached_get_memory_allocators(const memcached_st *ptr,
29 memcached_malloc_fn *mem_malloc,
30 memcached_free_fn *mem_free,
31 memcached_realloc_fn *mem_realloc,
32 memcached_calloc_fn *mem_calloc);
33
34 LIBMEMCACHED_API
35 void *memcached_get_memory_allocators_context(const memcached_st *ptr);
36
37 LIBMEMCACHED_LOCAL
38 void _libmemcached_free(const memcached_st *ptr, void *mem, void *context);
39
40 LIBMEMCACHED_LOCAL
41 void *_libmemcached_malloc(const memcached_st *ptr, const size_t size, void *context);
42
43 LIBMEMCACHED_LOCAL
44 void *_libmemcached_realloc(const memcached_st *ptr, void *mem, const size_t size, void *context);
45
46 LIBMEMCACHED_LOCAL
47 void *_libmemcached_calloc(const memcached_st *ptr, size_t nelem, size_t size, void *context);
48
49 LIBMEMCACHED_LOCAL
50 struct _allocators_st memcached_allocators_return_default(void);
51
52
53 #ifdef __cplusplus
54 }
55 #endif
56
57 #endif /* __MEMCACHED_ALLOCATORS_H__ */