revert between 56095 -> 55830 in arch
[AROS.git] / rom / exec / freeentry.c
blob4c1354e3c34b1dcd6a2d457361d916b590e44841
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Free memory allocated with AllocEntry().
6 Lang: english
7 */
8 #include <aros/libcall.h>
9 #include <exec/memory.h>
10 #include <proto/exec.h>
12 #include "exec_debug.h"
14 #ifndef DEBUG_FreeEntry
15 # define DEBUG_FreeEntry 0
16 #endif
17 #undef DEBUG
18 #if DEBUG_FreeEntry
19 # define DEBUG 1
20 #endif
22 #include "exec_intern.h"
24 /*****************************************************************************
26 NAME */
28 AROS_LH1(void, FreeEntry,
30 /* SYNOPSIS */
31 AROS_LHA(struct MemList *, entry,A0),
33 /* LOCATION */
34 struct ExecBase *, SysBase, 38, Exec)
37 /* FUNCTION
38 Free some memory allocated with AllocEntry().
40 INPUTS
41 entry - The MemList you got from AllocEntry().
43 RESULT
45 NOTES
47 EXAMPLE
49 BUGS
51 SEE ALSO
52 AllocEntry()
54 INTERNALS
56 ******************************************************************************/
58 AROS_LIBFUNC_INIT
59 ULONG i;
61 /* First free all blocks in the MemList */
62 for(i=0;i<entry->ml_NumEntries;i++)
64 D(bug("[FreeEntry] Freeing size %d at 0x%p\n", entry->ml_ME[i].me_Length,entry->ml_ME[i].me_Addr));
65 FreeMem(entry->ml_ME[i].me_Addr,entry->ml_ME[i].me_Length);
68 /* Then free the MemList itself */
69 FreeMem(entry,sizeof(struct MemList)-sizeof(struct MemEntry)+
70 sizeof(struct MemEntry)*entry->ml_NumEntries);
71 AROS_LIBFUNC_EXIT
72 } /* FreeEntry */