Don't call ReadArgs() if started from WB.
[tangerine.git] / compiler / clib / free.c
blob827ac64979132b1035fb55c0b086d4c9291648c2
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
5 ANSI C function free().
6 */
8 #include "__arosc_privdata.h"
10 #include <exec/memory.h>
11 #include <proto/exec.h>
13 /*****************************************************************************
15 NAME */
16 #include <stdlib.h>
18 void free (
20 /* SYNOPSIS */
21 void * memory)
23 /* FUNCTION
24 Return memory allocated with malloc() or a similar function to the
25 system.
27 INPUTS
28 memory - The result of the previous call to malloc(), etc. or
29 NULL.
31 RESULT
32 None.
34 NOTES
35 This function must not be used in a shared library or in a threaded
36 application.
38 EXAMPLE
40 BUGS
42 SEE ALSO
43 malloc()
45 INTERNALS
47 ******************************************************************************/
49 if (memory)
51 AROS_GET_SYSBASE_OK
53 unsigned char *mem;
54 size_t size;
56 mem = ((UBYTE *)memory) - AROS_ALIGN(sizeof(size_t));
57 size = *((size_t *)mem) + AROS_ALIGN(sizeof(size_t));
59 FreePooled (__startup_mempool, mem, size);
62 } /* free */