wrong version committed
[AROS.git] / rom / utility / releasenamedobject.c
blob48e0085e51f8e7f8cccb6dd6e958a4e83df1a0c3
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: ReleaseNamedObject()
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, ReleaseNamedObject,
18 /* SYNOPSIS */
19 AROS_LHA(struct NamedObject *, object, A0),
21 /* LOCATION */
22 struct UtilityBase *, UtilityBase, 43, Utility)
24 /* FUNCTION
25 Releases a NamedObject that you previously obtained by calling
26 FindNamedObject.
28 INPUTS
29 object - The NamedObject to release.
31 RESULT
32 The NamedObject will be released from your possession, and if it
33 is ready to be deallocated, then the NamedObject will be freed.
35 NOTES
36 WARNING: You really should actually have found the NamedObject
37 first (that is with FindNamedObject()) before calling this
38 function. Failure to take heed of this will cause memory
39 use problems.
41 EXAMPLE
42 struct NamedObject *nObj, *myNameSpace;
44 if( nObj = FindNamedObject( myNameSpace, "Some Name", NULL ) )
47 Here you do whatever you want. However The NamedObject
48 structure should generally be treated READ-ONLY
51 ReleaseNamedObject( nObj );
54 BUGS
56 SEE ALSO
57 utility/name.h, FindNamedObject()
59 INTERNALS
61 HISTORY
62 29-10-95 digulla automatically created from
63 utility_lib.fd and clib/utility_protos.h
64 11-08-96 iaint Adapted for AROS 1.5+.
65 18-10-96 iaint Changed for different format NamedObjects.
67 *****************************************************************************/
69 AROS_LIBFUNC_INIT
71 struct IntNamedObject *no;
73 if( object )
75 Forbid();
76 no = GetIntNamedObject( object );
78 /* if(no more users) */
79 if( --no->no_UseCount == 0 )
81 if( no->no_FreeMessage ) RemNamedObject( object, NULL );
83 Permit();
86 AROS_LIBFUNC_EXIT
88 } /* ReleaseNamedObject */