bump version
[AROS.git] / rom / utility / freenamedobject.c
blob7410e99ebd750b3232fcf9117fe5a8262d002e5f
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: FreeNamedObject() - Free a NamedObject.
6 Lang: english
7 */
8 #include <proto/exec.h>
9 #include "intern.h"
11 /*****************************************************************************
13 NAME */
14 #include <proto/utility.h>
16 AROS_LH1(void, FreeNamedObject,
18 /* SYNOPSIS */
19 AROS_LHA(struct NamedObject *, object, A0),
21 /* LOCATION */
22 struct UtilityBase *, UtilityBase, 41, Utility)
24 /* FUNCTION
25 Frees a NamedObject previously allocated by AllocNamedObject().
27 INPUTS
28 object - The NamedObject that you wish to free.
30 RESULT
31 The memory used by the NamedObject will be returned to the
32 systems free memory pool.
34 NOTES
36 EXAMPLE
38 BUGS
40 SEE ALSO
41 utility/name.h, AllocNamedObjectA()
43 INTERNALS
44 AllocMem:
45 NameSpace;
46 AllocVec:
47 IntNamedObject, Object.
49 FreeNamedObject() may have to deal with only a partially allocated
50 object from AllocNamedObject() which has come across an error.
52 HISTORY
53 29-10-95 digulla automatically created from
54 utility_lib.fd and clib/utility_protos.h
55 11-08-96 iaint Adapted for AROS code.
56 08-10-96 iaint Modified after discussion in AROS-DEV.
57 19-10-96 iaint Finished above.
58 16-04-01 iaint Combined the memory for the name and
59 IntNamedObject as an optimisation.
61 *****************************************************************************/
63 AROS_LIBFUNC_INIT
65 if( object )
67 struct IntNamedObject *no = GetIntNamedObject(object);
69 if(object->no_Object && no->no_FreeObject)
70 FreeVec(object->no_Object);
72 if(no->no_NameSpace)
73 FreeMem(no->no_NameSpace, sizeof(struct NameSpace));
75 FreeVec(object);
77 AROS_LIBFUNC_EXIT
79 } /* FreeNamedObject */