grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / intuition / freeintuimessage.c
blob6cca43d86f0a332a5dbd1b9cda31b323b036c133
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 <proto/utility.h>
8 #include "intuition_intern.h"
10 /*****i***********************************************************************
12 NAME */
13 #include <proto/intuition.h>
15 AROS_LH1(void, FreeIntuiMessage,
17 /* SYNOPSIS */
18 AROS_LHA(struct IntuiMessage *, imsg, A0),
20 /* LOCATION */
21 struct IntuitionBase *, IntuitionBase, 149, Intuition)
23 /* FUNCTION
24 Private to AROS: free an IntuiMessage previously allocated
25 with AllocIntuiMessage.
27 INPUTS
28 imsg - The IntuiMessage. May be NULL.
30 RESULT
31 None.
33 NOTES
34 This private function is also present in MorphOS v50.
36 EXAMPLE
38 BUGS
40 SEE ALSO
42 INTERNALS
44 *****************************************************************************/
46 AROS_LIBFUNC_INIT
48 struct Library *UtilityBase = GetPrivIBase(IntuitionBase)->UtilityBase;
49 DEBUG_FREEINTUIMESSAGE(dprintf("FreeIntuiMessage: Msg 0x%lx\n", imsg));
51 ASSERT_VALID_PTR_OR_NULL(imsg);
53 #define EIM(x) ((struct ExtIntuiMessage *)(x))
55 if (imsg)
57 if ((imsg->Class == IDCMP_IDCMPUPDATE) && (imsg->IAddress))
59 FreeTagItems((struct TagItem *)imsg->IAddress);
62 if (EIM(imsg)->eim_TabletData)
64 if (EIM(imsg)->eim_TabletData->td_TagList) FreeTagItems(EIM(imsg)->eim_TabletData->td_TagList);
65 FreePooled(GetPrivIBase(IntuitionBase)->IDCMPPool,EIM(imsg)->eim_TabletData,sizeof (struct TabletData));
67 FreePooled(GetPrivIBase(IntuitionBase)->IDCMPPool,imsg, sizeof(struct IntIntuiMessage));
70 DEBUG_FREEINTUIMESSAGE(dprintf("FreeIntuiMessage: done\n"));
71 AROS_LIBFUNC_EXIT