aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/memorypool.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/memorypool.c')
-rw-r--r--src/microhttpd/memorypool.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/microhttpd/memorypool.c b/src/microhttpd/memorypool.c
index db347056..56fb75fe 100644
--- a/src/microhttpd/memorypool.c
+++ b/src/microhttpd/memorypool.c
@@ -95,7 +95,7 @@ MHD_pool_create (size_t max)
95 if (max <= 32 * 1024) 95 if (max <= 32 * 1024)
96 pool->memory = MAP_FAILED; 96 pool->memory = MAP_FAILED;
97 else 97 else
98 pool->memory = MMAP (NULL, max, PROT_READ | PROT_WRITE, 98 pool->memory = mmap (NULL, max, PROT_READ | PROT_WRITE,
99 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); 99 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
100#else 100#else
101 pool->memory = MAP_FAILED; 101 pool->memory = MAP_FAILED;
@@ -134,7 +134,11 @@ MHD_pool_destroy (struct MemoryPool *pool)
134 if (pool->is_mmap == MHD_NO) 134 if (pool->is_mmap == MHD_NO)
135 free (pool->memory); 135 free (pool->memory);
136 else 136 else
137 MUNMAP (pool->memory, pool->size); 137#ifndef WINDOWS
138 munmap (pool->memory, pool->size);
139#else
140 VirtualFree (pool->memory, 0, MEM_RELEASE);
141#endif
138 free (pool); 142 free (pool);
139} 143}
140 144
@@ -151,7 +155,7 @@ MHD_pool_destroy (struct MemoryPool *pool)
151 * bytes 155 * bytes
152 */ 156 */
153void * 157void *
154MHD_pool_allocate (struct MemoryPool *pool, 158MHD_pool_allocate (struct MemoryPool *pool,
155 size_t size, int from_end) 159 size_t size, int from_end)
156{ 160{
157 void *ret; 161 void *ret;
@@ -192,8 +196,8 @@ MHD_pool_allocate (struct MemoryPool *pool,
192 */ 196 */
193void * 197void *
194MHD_pool_reallocate (struct MemoryPool *pool, 198MHD_pool_reallocate (struct MemoryPool *pool,
195 void *old, 199 void *old,
196 size_t old_size, 200 size_t old_size,
197 size_t new_size) 201 size_t new_size)
198{ 202{
199 void *ret; 203 void *ret;
@@ -242,8 +246,8 @@ MHD_pool_reallocate (struct MemoryPool *pool,
242 * @return addr new address of "keep" (if it had to change) 246 * @return addr new address of "keep" (if it had to change)
243 */ 247 */
244void * 248void *
245MHD_pool_reset (struct MemoryPool *pool, 249MHD_pool_reset (struct MemoryPool *pool,
246 void *keep, 250 void *keep,
247 size_t size) 251 size_t size)
248{ 252{
249 size = ROUND_TO_ALIGN (size); 253 size = ROUND_TO_ALIGN (size);