some fixes to accented characters
[tangerine.git] / rom / exec / deletepool.c
blobc42ca368a8aa2717bfbaea100a6ef49deaa61dd7
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Delete a memory pool including all its memory.
6 Lang: english
7 */
8 #include "exec_intern.h"
9 #include <aros/libcall.h>
10 #include "memory.h"
11 #include <exec/memory.h>
12 #include <proto/exec.h>
14 /*****************************************************************************
16 NAME */
18 AROS_LH1(void, DeletePool,
20 /* SYNOPSIS */
21 AROS_LHA(APTR, poolHeader, A0),
23 /* LOCATION */
24 struct ExecBase *, SysBase, 117, Exec)
26 /* FUNCTION
27 Delete a pool including all it's memory.
29 INPUTS
30 poolHeader - The pool allocated with CreatePool() or NULL.
32 RESULT
34 NOTES
36 EXAMPLE
38 BUGS
40 SEE ALSO
41 CreatePool(), AllocPooled(), FreePooled()
43 INTERNALS
45 ******************************************************************************/
47 AROS_LIBFUNC_INIT
49 struct Pool *pool = (struct Pool *)poolHeader;
51 /* It is legal to DeletePool(NULL) */
52 if(pool != NULL)
54 struct Block *bl;
55 void *p;
56 ULONG size;
58 /* Calculate the total size of a puddle including header. */
59 size = pool->PuddleSize + MEMHEADER_TOTAL;
61 /* Free the list of puddles */
62 while((p = RemHead((struct List *)&pool->PuddleList)) !=NULL )
64 FreeMem(p, size);
67 /* Free the list of single Blocks */
68 while((bl = (struct Block *)RemHead((struct List *)&pool->BlockList)) != NULL)
70 FreeMem(bl, bl->Size);
73 FreeMem(pool, (pool->Requirements & MEMF_SEM_PROTECTED) ? sizeof(struct ProtectedPool) :
74 sizeof(struct Pool));
77 AROS_LIBFUNC_EXIT
79 } /* DeletePool */