aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/memorypool.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/memorypool.c')
-rw-r--r--src/daemon/memorypool.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/daemon/memorypool.c b/src/daemon/memorypool.c
index 6310d7d7..1bb12bae 100644
--- a/src/daemon/memorypool.c
+++ b/src/daemon/memorypool.c
@@ -188,4 +188,33 @@ MHD_pool_reallocate (struct MemoryPool *pool,
188 return NULL; 188 return NULL;
189} 189}
190 190
191/**
192 * Clear all entries from the memory pool except
193 * for "keep" of the given "size".
194 *
195 * @param keep pointer to the entry to keep (maybe NULL)
196 * @param size how many bytes need to be kept at this address
197 * @return addr new address of "keep" (if it had to change)
198 */
199void *MHD_pool_reset(struct MemoryPool * pool,
200 void * keep,
201 unsigned int size)
202{
203 if (keep != NULL)
204 {
205 if (keep != pool->memory)
206 {
207 memmove(pool->memory,
208 keep,
209 size);
210 keep = pool->memory;
211 }
212 pool->pos = size;
213 }
214 pool->end = pool->size;
215 return keep;
216}
217
218
219
191/* end of memorypool.c */ 220/* end of memorypool.c */