revert between 56095 -> 55830 in arch
[AROS.git] / rom / graphics / gfxfree.c
blobce9b346194458ea2537df49af616f304c543de46
1 /*
2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
9 #include <aros/debug.h>
10 #include <exec/types.h>
11 #include <graphics/gfxbase.h>
12 #include <graphics/gfxnodes.h>
13 #include <graphics/monitor.h>
14 #include <graphics/view.h>
15 #include <proto/exec.h>
16 #include <proto/graphics.h>
18 #include "graphics_intern.h"
19 #include "gfxfuncsupport.h"
21 /*****************************************************************************
23 NAME */
25 AROS_LH1( void , GfxFree,
27 /* SYNOPSIS */
28 AROS_LHA(struct ExtendedNode *, node, A0),
30 /* LOCATION */
32 struct GfxBase *, GfxBase, 111, Graphics)
34 /* FUNCTION
35 Free a special graphics extended data structure which was preciously
36 allocated by GfxNew()
38 INPUTS
39 node = pointer to a graphics extended data structure obtained by
40 GfxNew()
42 RESULT
43 The node will be deallocated from memory. Graphics will disassociate
44 this special graphics extended node from any associated data
45 structure, if necessary, before freeing it (see GfxAssociate())
47 NOTES
49 EXAMPLE
51 BUGS
53 SEE ALSO
54 graphics/gfxnodes.h, GfxNew(), GfxAssociate(), GfxLookUp()
56 INTERNALS
58 HISTORY
60 ******************************************************************************/
62 AROS_LIBFUNC_INIT
64 const ULONG GfxNew_memsizes[] = { 0,
65 sizeof(struct ViewExtra),
66 sizeof(struct ViewPortExtra),
67 sizeof(struct SpecialMonitor),
68 sizeof(struct MonitorSpec)
71 D(bug("GfxFree(0x%p)\n", node));
72 if ( SS_GRAPHICS == node->xln_Subsystem &&
73 NT_GRAPHICS == node->xln_Type)
75 /* take the element out of the hashlist, if it is in the
76 hashlist */
77 D(bug("[GfxFree] xln_Succ 0x%p, xln_Pred 0x%p\n", node->xln_Succ, node->xln_Pred));
79 ObtainSemaphore(GfxBase->HashTableSemaphore);
81 /* if the element has a Successor */
82 if (NULL != node -> xln_Succ)
83 ((struct ExtendedNode *)(node -> xln_Succ)) -> xln_Pred = (struct Node *) (node -> xln_Pred);
85 /* if the previous Element is not the hashlist itself */
86 /* (the same code works also if the previous entry is the hashlist ) */
87 if (node->xln_Pred)
88 ((struct ExtendedNode *)(node -> xln_Pred)) -> xln_Succ = (struct Node *) (node -> xln_Succ);
90 ReleaseSemaphore(GfxBase->HashTableSemaphore);
92 FreeMem((void *) node, GfxNew_memsizes[node->xln_Subtype]);
95 AROS_LIBFUNC_EXIT
96 } /* GfxFree */