exec.library: Compiler lint
[AROS.git] / rom / exec / allocvecpooled.c
blob670249d304fd90499e9bf1a296cb1e5ea4584311
1 /*
2 Copyright � 2003-2012, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/libcall.h>
7 #include <proto/exec.h>
8 #include <exec/memheaderext.h>
9 #include "exec_intern.h"
10 #include <aros/debug.h>
12 AROS_LH2(APTR, AllocVecPooled,
13 AROS_LHA(APTR, pool, D0),
14 AROS_LHA(IPTR, size, D1),
15 struct ExecBase *, SysBase, 169, Exec)
17 AROS_LIBFUNC_INIT
19 struct MemHeaderExt *mhe = (struct MemHeaderExt *)pool;
21 if (mhe->mhe_MemHeader.mh_Attributes & MEMF_MANAGED)
23 ULONG attributes = (ULONG)(IPTR)mhe->mhe_MemHeader.mh_First;
25 if (mhe->mhe_Alloc)
26 return mhe->mhe_AllocVec(mhe, size, &attributes);
27 else
28 return NULL;
30 else
32 IPTR *memory;
34 if (pool == NULL) return NULL;
36 size += sizeof(IPTR);
37 memory = AllocPooled(pool, size);
39 if (memory != NULL)
41 *memory++ = size;
44 return memory;
47 AROS_LIBFUNC_EXIT
48 } /* AllocVecPooled() */