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, 7 insertions, 11 deletions
diff --git a/src/microhttpd/memorypool.c b/src/microhttpd/memorypool.c
index 56fb75fe..db347056 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,11 +134,7 @@ 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#ifndef WINDOWS 137 MUNMAP (pool->memory, pool->size);
138 munmap (pool->memory, pool->size);
139#else
140 VirtualFree (pool->memory, 0, MEM_RELEASE);
141#endif
142 free (pool); 138 free (pool);
143} 139}
144 140
@@ -155,7 +151,7 @@ MHD_pool_destroy (struct MemoryPool *pool)
155 * bytes 151 * bytes
156 */ 152 */
157void * 153void *
158MHD_pool_allocate (struct MemoryPool *pool, 154MHD_pool_allocate (struct MemoryPool *pool,
159 size_t size, int from_end) 155 size_t size, int from_end)
160{ 156{
161 void *ret; 157 void *ret;
@@ -196,8 +192,8 @@ MHD_pool_allocate (struct MemoryPool *pool,
196 */ 192 */
197void * 193void *
198MHD_pool_reallocate (struct MemoryPool *pool, 194MHD_pool_reallocate (struct MemoryPool *pool,
199 void *old, 195 void *old,
200 size_t old_size, 196 size_t old_size,
201 size_t new_size) 197 size_t new_size)
202{ 198{
203 void *ret; 199 void *ret;
@@ -246,8 +242,8 @@ MHD_pool_reallocate (struct MemoryPool *pool,
246 * @return addr new address of "keep" (if it had to change) 242 * @return addr new address of "keep" (if it had to change)
247 */ 243 */
248void * 244void *
249MHD_pool_reset (struct MemoryPool *pool, 245MHD_pool_reset (struct MemoryPool *pool,
250 void *keep, 246 void *keep,
251 size_t size) 247 size_t size)
252{ 248{
253 size = ROUND_TO_ALIGN (size); 249 size = ROUND_TO_ALIGN (size);