2 Copyright � 2003-2013, The AROS Development Team. All rights reserved.
6 #include <aros/libcall.h>
7 #include "exec_intern.h"
8 #include <aros/debug.h>
10 /*****************************************************************************
13 #include <exec/memory.h>
14 #include <exec/memheaderext.h>
15 #include <proto/exec.h>
17 AROS_LH2(APTR
, AllocVecPooled
,
20 AROS_LHA(APTR
, poolHeader
, A0
),
21 AROS_LHA(IPTR
, memSize
, D0
),
24 struct ExecBase
*, SysBase
, 169, Exec
)
27 Allocate memory out of a private memory pool and remember the size.
28 The memory must be freed with FreeVecPooled(), or by deallocating
29 the entire pool with DeletePool().
32 poolHeader - Handle of the memory pool
33 memSize - Number of bytes you want to get
36 A pointer to the number of bytes you wanted or NULL if the memory
46 CreatePool(), DeletePool(), FreeVecPooled()
50 ******************************************************************************/
54 struct MemHeaderExt
*mhe
= (struct MemHeaderExt
*)poolHeader
;
56 /* 0-sized allocation results in returning NULL (API guarantee) */
60 if (IsManagedMem(mhe
))
62 ULONG poolrequirements
= (ULONG
)(IPTR
)mhe
->mhe_MemHeader
.mh_First
;
65 return mhe
->mhe_AllocVec(mhe
, memSize
, &poolrequirements
);
73 if (poolHeader
== NULL
) return NULL
;
75 memSize
+= sizeof(IPTR
);
76 memory
= AllocPooled(poolHeader
, memSize
);
87 } /* AllocVecPooled() */