Commit of the code which was suggested by Georg as a fix for:
[cake.git] / rom / exec / freeentry.c
blob7951b2cd57294cfb2ddb704ccaf933f568775a4a
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 "exec_intern.h"
9 #include <aros/libcall.h>
10 #include <exec/memory.h>
11 #include <proto/exec.h>
13 /*****************************************************************************
15 NAME */
17 AROS_LH1(void, FreeEntry,
19 /* SYNOPSIS */
20 AROS_LHA(struct MemList *, entry,A0),
22 /* LOCATION */
23 struct ExecBase *, SysBase, 38, Exec)
26 /* FUNCTION
27 Free some memory allocated with AllocEntry().
29 INPUTS
30 entry - The MemList you got from AllocEntry().
32 RESULT
34 NOTES
36 EXAMPLE
38 BUGS
40 SEE ALSO
41 AllocEntry()
43 INTERNALS
45 ******************************************************************************/
47 AROS_LIBFUNC_INIT
48 ULONG i;
50 /* First free all blocks in the MemList */
51 for(i=0;i<entry->ml_NumEntries;i++)
52 FreeMem(entry->ml_ME[i].me_Addr,entry->ml_ME[i].me_Length);
54 /* Then free the MemList itself */
55 FreeMem(entry,sizeof(struct MemList)-sizeof(struct MemEntry)+
56 sizeof(struct MemEntry)*entry->ml_NumEntries);
57 AROS_LIBFUNC_EXIT
58 } /* FreeEntry */