aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/memorypool.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-03-31 17:02:07 +0000
committerChristian Grothoff <christian@grothoff.org>2013-03-31 17:02:07 +0000
commitdbc57ff2f07ebed0755d4803a5bb5d192b64822a (patch)
tree882f3f003588e219fe7d2ec267029a6ab2888968 /src/daemon/memorypool.c
parent61456e4b13291054afcf420952e2ca4c14783894 (diff)
downloadlibmicrohttpd-dbc57ff2f07ebed0755d4803a5bb5d192b64822a.tar.gz
libmicrohttpd-dbc57ff2f07ebed0755d4803a5bb5d192b64822a.zip
-formatting
Diffstat (limited to 'src/daemon/memorypool.c')
-rw-r--r--src/daemon/memorypool.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/daemon/memorypool.c b/src/daemon/memorypool.c
index 329a11c0..32f5217f 100644
--- a/src/daemon/memorypool.c
+++ b/src/daemon/memorypool.c
@@ -42,6 +42,11 @@
42 */ 42 */
43#define ROUND_TO_ALIGN(n) ((n+(ALIGN_SIZE-1)) & (~(ALIGN_SIZE-1))) 43#define ROUND_TO_ALIGN(n) ((n+(ALIGN_SIZE-1)) & (~(ALIGN_SIZE-1)))
44 44
45
46/**
47 * Handle for a memory pool. Pools are not reentrant and must not be
48 * used by multiple threads.
49 */
45struct MemoryPool 50struct MemoryPool
46{ 51{
47 52
@@ -71,6 +76,7 @@ struct MemoryPool
71 int is_mmap; 76 int is_mmap;
72}; 77};
73 78
79
74/** 80/**
75 * Create a memory pool. 81 * Create a memory pool.
76 * 82 *
@@ -110,6 +116,7 @@ MHD_pool_create (size_t max)
110 return pool; 116 return pool;
111} 117}
112 118
119
113/** 120/**
114 * Destroy a memory pool. 121 * Destroy a memory pool.
115 */ 122 */
@@ -125,6 +132,7 @@ MHD_pool_destroy (struct MemoryPool *pool)
125 free (pool); 132 free (pool);
126} 133}
127 134
135
128/** 136/**
129 * Allocate size bytes from the pool. 137 * Allocate size bytes from the pool.
130 * @return NULL if the pool cannot support size more 138 * @return NULL if the pool cannot support size more
@@ -152,6 +160,7 @@ MHD_pool_allocate (struct MemoryPool *pool,
152 return ret; 160 return ret;
153} 161}
154 162
163
155/** 164/**
156 * Reallocate a block of memory obtained from the pool. 165 * Reallocate a block of memory obtained from the pool.
157 * This is particularly efficient when growing or 166 * This is particularly efficient when growing or
@@ -209,6 +218,7 @@ MHD_pool_reallocate (struct MemoryPool *pool,
209 return NULL; 218 return NULL;
210} 219}
211 220
221
212/** 222/**
213 * Clear all entries from the memory pool except 223 * Clear all entries from the memory pool except
214 * for "keep" of the given "size". 224 * for "keep" of the given "size".
@@ -237,5 +247,4 @@ MHD_pool_reset (struct MemoryPool *pool,
237} 247}
238 248
239 249
240
241/* end of memorypool.c */ 250/* end of memorypool.c */