diff options
Diffstat (limited to 'sdk/other/memrelease.c')
-rw-r--r-- | sdk/other/memrelease.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/sdk/other/memrelease.c b/sdk/other/memrelease.c new file mode 100644 index 0000000..144bff6 --- /dev/null +++ b/sdk/other/memrelease.c @@ -0,0 +1,43 @@ +/* + * Relallocate and release memory pools. + * $Id$ + * Copyright (c) 1997 by Tycho Softworks. + * For conditions of distribution and reuse see product license. + */ + +#include <other/memory.h> + +void memrelease(MEMPOOL *mem) +{ + MEMPAGE *page = memfirst(mem); + MEMPAGE *next; + + while(page) + { + next = page->page_next; + free(page); + page = next; + } +} + +void memreuse(MEMPOOL *mem) +{ + MEMPAGE *page = memfirst(mem); + MEMPAGE *next; + + page = page->page_next; + while(page) + { + next = page->page_next; + free(page); + page = next; + } + mem->mem_pused = 1; + mem->mem_free = NULL; + page = mem->mem_last = memfirst(mem); + page->page_used = 0; + page->page_next = NULL; +} + + + |