Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / commodities / deletecxobjall.c
blob33ed453c862a225cfcef9e3e1346975f92db7120
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 /*****************************************************************************
11 NAME */
13 #include "cxintern.h"
14 #include <exec/lists.h>
15 #include <proto/exec.h>
16 #include <proto/commodities.h>
18 VOID RecRem(CxObj *, struct Library *CxBase);
20 AROS_LH1(VOID, DeleteCxObjAll,
22 /* SYNOPSIS */
24 AROS_LHA(CxObj *, co, A0),
26 /* LOCATION */
28 struct Library *, CxBase, 9, Commodities)
30 /* FUNCTION
32 Delete object and and all objects connected to commodity object 'co'.
33 Handy for instances like when you are shutting down your commodity.
34 To remove your commodity tree, just DeleteCxObjAll(YourBroker).
36 INPUTS
38 co -- the object in question (may be NULL)
40 RESULT
42 NOTES
44 The handle 'co' is invalid after the operation.
46 EXAMPLE
48 BUGS
50 SEE ALSO
52 DeleteCxObj()
54 INTERNALS
56 HISTORY
58 ******************************************************************************/
61 AROS_LIBFUNC_INIT
63 if (co == NULL)
65 return;
68 RemoveCxObj(co);
69 RecRem((CxObj *)GetHead(&co->co_ObjList), CxBase);
70 FreeCxStructure(co, CX_OBJECT, CxBase);
72 AROS_LIBFUNC_EXIT
73 } /* DeleteCxObjAll */
76 VOID RecRem(CxObj *obj, struct Library *CxBase)
78 CxObj *next;
80 while (obj != NULL)
82 RecRem((CxObj *)GetHead(&obj->co_ObjList), CxBase);
84 next = (CxObj *)GetSucc(obj);
85 FreeCxStructure(obj, CX_OBJECT, CxBase);
86 obj = next;