cleanup debug
[AROS.git] / rom / exec / freepooled.c
blobc2dd992f13397a87d0379aba95ddd685302a0933
1 /*
2 Copyright � 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Free memory allocated by AllocPooled().
6 Lang: english
7 */
9 #include <aros/libcall.h>
10 #include <exec/memory.h>
11 #include <exec/memheaderext.h>
12 #include <proto/exec.h>
14 #include "exec_intern.h"
15 #include "exec_util.h"
16 #include "memory.h"
18 /*****************************************************************************
20 NAME */
22 AROS_LH3(void,FreePooled,
24 /* SYNOPSIS */
25 AROS_LHA(APTR, poolHeader,A0),
26 AROS_LHA(APTR, memory, A1),
27 AROS_LHA(IPTR, memSize, D0),
29 /* LOCATION */
30 struct ExecBase *, SysBase, 119, Exec)
32 /* FUNCTION
33 Free memory that was allocated out of a private memory pool by
34 AllocPooled().
36 INPUTS
37 poolHeader - Handle of the memory pool
38 memory - Pointer to the memory
39 memSize - Size of the memory chunk
41 RESULT
43 NOTES
45 EXAMPLE
47 BUGS
49 SEE ALSO
50 CreatePool(), DeletePool(), AllocPooled()
52 INTERNALS
54 ******************************************************************************/
56 AROS_LIBFUNC_INIT
58 struct MemHeaderExt *mhe = (struct MemHeaderExt *)poolHeader;
60 /* If there is nothing to free do nothing. */
61 if(!memSize || !memory)
62 return;
64 if (IsManagedMem(mhe))
66 if (mhe->mhe_Free)
67 mhe->mhe_Free(mhe, memory, memSize);
69 else
71 struct TraceLocation tp = CURRENT_LOCATION("FreePooled");
73 InternalFreePooled(poolHeader, memory, memSize, &tp, SysBase);
76 AROS_LIBFUNC_EXIT
77 } /* FreePooled */