2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
5 Desc: Allocate some memory.
8 #include "exec_intern.h"
9 #include <aros/libcall.h>
11 #include <proto/exec.h>
13 /*****************************************************************************
17 AROS_LH2(APTR
, AllocVec
,
20 AROS_LHA(IPTR
, byteSize
, D0
),
21 AROS_LHA(ULONG
, requirements
, D1
),
24 struct ExecBase
*, SysBase
, 114, Exec
)
27 Allocate some memory from the sytem memory pool with the given
28 requirements and without the need to memorize the actual size
32 byteSize - Number of bytes you want to get
33 requirements - Type of memory
36 A pointer to the number of bytes you wanted or NULL if the memory
50 ******************************************************************************/
56 /* 0-sized allocation results in returning NULL (API guarantee) */
60 /* Add room for stored size. */
61 byteSize
+=AROS_ALIGN(sizeof(IPTR
));
64 ret
=(UBYTE
*)AllocMem(byteSize
,requirements
);
66 /* If there's not enough memory left return immediately. */
71 *(IPTR
*)ret
=byteSize
;
73 /* return free space */
74 return ret
+AROS_ALIGN(sizeof(IPTR
));