2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Delete a memory pool including all its memory.
8 #include "exec_intern.h"
9 #include <aros/libcall.h>
11 #include <exec/memory.h>
12 #include <proto/exec.h>
14 /*****************************************************************************
18 AROS_LH1(void, DeletePool
,
21 AROS_LHA(APTR
, poolHeader
, A0
),
24 struct ExecBase
*, SysBase
, 117, Exec
)
27 Delete a pool including all it's memory.
30 poolHeader - The pool allocated with CreatePool() or NULL.
41 CreatePool(), AllocPooled(), FreePooled()
45 ******************************************************************************/
49 struct Pool
*pool
= (struct Pool
*)poolHeader
;
51 /* It is legal to DeletePool(NULL) */
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
)
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
) :