aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/memorypool.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/memorypool.h')
-rw-r--r--src/daemon/memorypool.h32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/daemon/memorypool.h b/src/daemon/memorypool.h
index 51f81674..3dfd4dcc 100644
--- a/src/daemon/memorypool.h
+++ b/src/daemon/memorypool.h
@@ -37,17 +37,22 @@
37 */ 37 */
38struct MemoryPool; 38struct MemoryPool;
39 39
40
40/** 41/**
41 * Create a memory pool. 42 * Create a memory pool.
42 * 43 *
43 * @param max maximum size of the pool 44 * @param max maximum size of the pool
44 */ 45 */
45struct MemoryPool *MHD_pool_create (size_t max); 46struct MemoryPool *
47MHD_pool_create (size_t max);
48
46 49
47/** 50/**
48 * Destroy a memory pool. 51 * Destroy a memory pool.
49 */ 52 */
50void MHD_pool_destroy (struct MemoryPool *pool); 53void
54MHD_pool_destroy (struct MemoryPool *pool);
55
51 56
52/** 57/**
53 * Allocate size bytes from the pool. 58 * Allocate size bytes from the pool.
@@ -58,8 +63,10 @@ void MHD_pool_destroy (struct MemoryPool *pool);
58 * @return NULL if the pool cannot support size more 63 * @return NULL if the pool cannot support size more
59 * bytes 64 * bytes
60 */ 65 */
61void *MHD_pool_allocate (struct MemoryPool *pool, 66void *
62 size_t size, int from_end); 67MHD_pool_allocate (struct MemoryPool *pool,
68 size_t size, int from_end);
69
63 70
64/** 71/**
65 * Reallocate a block of memory obtained from the pool. 72 * Reallocate a block of memory obtained from the pool.
@@ -77,10 +84,12 @@ void *MHD_pool_allocate (struct MemoryPool *pool,
77 * NULL if the pool cannot support new_size 84 * NULL if the pool cannot support new_size
78 * bytes (old continues to be valid for old_size) 85 * bytes (old continues to be valid for old_size)
79 */ 86 */
80void *MHD_pool_reallocate (struct MemoryPool *pool, 87void *
81 void *old, 88MHD_pool_reallocate (struct MemoryPool *pool,
82 size_t old_size, 89 void *old,
83 size_t new_size); 90 size_t old_size,
91 size_t new_size);
92
84 93
85/** 94/**
86 * Clear all entries from the memory pool except 95 * Clear all entries from the memory pool except
@@ -90,8 +99,9 @@ void *MHD_pool_reallocate (struct MemoryPool *pool,
90 * @param size how many bytes need to be kept at this address 99 * @param size how many bytes need to be kept at this address
91 * @return addr new address of "keep" (if it had to change) 100 * @return addr new address of "keep" (if it had to change)
92 */ 101 */
93void *MHD_pool_reset (struct MemoryPool *pool, 102void *
94 void *keep, 103MHD_pool_reset (struct MemoryPool *pool,
95 size_t size); 104 void *keep,
105 size_t size);
96 106
97#endif 107#endif