Include <X11/Xlib.h> even if USE_VIDMODE is
[tangerine.git] / rom / exec / allocentry.c
blobefec31d3eee155f6985597a20968845e821414c1
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Allocate memory.
6 Lang: english
7 */
8 #include <aros/config.h>
9 #include "exec_intern.h"
10 #include <aros/libcall.h>
11 #include <exec/memory.h>
12 #include <proto/exec.h>
14 #include "exec_debug.h"
15 #ifndef DEBUG_AllocEntry
16 # define DEBUG_AllocEntry 0
17 #endif
18 #undef DEBUG
19 #if DEBUG_AllocEntry
20 # define DEBUG 1
21 #endif
22 #include <aros/debug.h>
23 #undef kprintf
25 /*****************************************************************************
27 NAME */
29 AROS_LH1(struct MemList *, AllocEntry,
31 /* SYNOPSIS */
32 AROS_LHA(struct MemList *, entry, A0),
34 /* LOCATION */
35 struct ExecBase *, SysBase, 37, Exec)
37 /* FUNCTION
38 Allocate a number of memory blocks through a MemList structure.
40 INPUTS
41 entry - The MemList with one MemEntry for each block you want to get
43 RESULT
44 The allocation was successful if the most significant bit of the
45 result is 0. The result then contains a pointer to a copy of
46 the MemList structure with the me_Addr fields filled.
47 If the most significant bit is set the result contains the type of
48 memory that couldn't be allocated.
50 NOTES
52 EXAMPLE
54 BUGS
56 SEE ALSO
57 FreeEntry()
59 INTERNALS
61 ******************************************************************************/
63 AROS_LIBFUNC_INIT
65 struct MemList *ret;
66 ULONG ret_flags;
68 if (NewAllocEntry(entry, &ret, &ret_flags))
70 /* Check nasty case where the returncode is misleading :-(
71 Like when memory was allocated at address 0x8???????. And
72 0x80000000 flag is at the same time used to indicate allocentry
73 failure! */
75 if(!AROS_CHECK_ALLOCENTRY(ret))
77 FreeEntry(ret);
78 ret = AROS_ALLOCENTRY_FAILED(MEMF_PUBLIC);
81 else
83 ret = AROS_ALLOCENTRY_FAILED(ret_flags);
86 return ret;
88 AROS_LIBFUNC_EXIT
89 } /* AllocEntry */