revert between 56095 -> 55830 in arch
[AROS.git] / rom / intuition / allocremember.c
blobfc5ed9340531d60bd7afd8ca5e23e558dad80422
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
5 */
7 #include "intuition_intern.h"
8 #include <exec/memory.h>
9 #include <proto/exec.h>
11 /*****************************************************************************
13 NAME */
14 #include <intuition/intuition.h>
15 #include <proto/intuition.h>
17 AROS_LH3(APTR, AllocRemember,
19 /* SYNOPSIS */
20 AROS_LHA(struct Remember **, rememberKey, A0),
21 AROS_LHA(ULONG , size, D0),
22 AROS_LHA(ULONG , flags, D1),
24 /* LOCATION */
25 struct IntuitionBase *, IntuitionBase, 66, Intuition)
27 /* FUNCTION
28 Allocate some memory and remember it in the Remember-List.
30 INPUTS
31 rememberKey - Store information in this list. Must be NULL for
32 initial call.
33 size - How many bytes to allocate
34 flags - Attributes (see AllocMem())
36 RESULT
37 Pointer to the allocated memory or NULL.
39 NOTES
41 EXAMPLE
42 struct Remember *remkey;
43 remkey = NULL;
44 AllocRemember(&remkey, BUFSIZE, MEMF_ANY);
45 FreeRemember(&remkey, TRUE);
47 BUGS
49 SEE ALSO
51 INTERNALS
53 *****************************************************************************/
55 AROS_LIBFUNC_INIT
57 struct Remember *newKey;
58 APTR ptr = NULL;
60 DEBUG_REMEMBER(dprintf("AllocRemember: Key 0x%lx Size 0x%lx Flags 0x%08lx\n",
61 rememberKey, size, flags));
63 newKey = AllocMem (sizeof (struct Remember), MEMF_ANY);
65 if (newKey)
67 ptr = AllocMem (size, flags);
69 if (ptr)
71 newKey->NextRemember = *rememberKey;
72 newKey->Memory = ptr;
73 newKey->RememberSize = size;
75 *rememberKey = newKey;
77 else
79 FreeMem (newKey, sizeof (struct Remember));
83 DEBUG_REMEMBER(dprintf("AllocRemember: Ptr 0x%lx\n", ptr));
85 return ptr;
87 AROS_LIBFUNC_EXIT
88 } /* AllocRemember */