grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / exec / freevec.c
blob7f8f35aa8fb42964357bf3424b663cbc4568695f
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Free memory allocated by AllocVec().
6 Lang: english
7 */
8 #include "exec_intern.h"
9 #include <aros/libcall.h>
10 #include "memory.h"
11 #include <proto/exec.h>
13 /*****************************************************************************
15 NAME */
17 AROS_LH1(void, FreeVec,
19 /* SYNOPSIS */
20 AROS_LHA(APTR, memoryBlock, A1),
22 /* LOCATION */
23 struct ExecBase *, SysBase, 115, Exec)
25 /* FUNCTION
26 Free some memory previously allocated with AllocVec().
28 INPUTS
29 memoryBlock - The memory to be freed. It is safe to try to free a NULL
30 pointer.
32 RESULT
34 NOTES
36 EXAMPLE
38 BUGS
40 SEE ALSO
41 AllocVec()
43 INTERNALS
45 ******************************************************************************/
47 AROS_LIBFUNC_INIT
49 /* If there is nothing to free do nothing. */
50 if(!memoryBlock)
51 return;
53 memoryBlock -= AROS_ALIGN(sizeof(IPTR));
54 FreeMem(memoryBlock, *((IPTR *)memoryBlock));
56 AROS_LIBFUNC_EXIT
57 } /* FreeVec */