Removed the non-working PDTA_Screen from ObtainDTDrawInfo
[AROS-Contrib.git] / libini / iniObjectDelete.c
blob5048576a7a2654fc0e3833cfa83898ce9d49faa2
1 /**********************************************************************************
2 * .
5 **************************************************
6 * This code was created by Peter Harvey @ CodeByDesign.
7 * Released under LGPL 28.JAN.99
9 * Contributions from...
10 * -----------------------------------------------
11 * Peter Harvey - pharvey@codebydesign.com
12 **************************************************/
14 #include "inifile_intern.h"
15 #include "ini.h"
16 #include <aros/libcall.h>
18 /*****************************************************************************
19 NAME */
20 AROS_LH1(int, iniObjectDelete,
22 /* SYNOPSIS */
23 AROS_LHA(HINI, hIni, D0),
25 /* LOCATION */
26 struct Library *, inifileBase, 20, inifile)
28 /* FUNCTION
30 INPUTS
32 RESULT
34 NOTES
36 EXAMPLE
38 BUGS
40 SEE ALSO
42 INTERNALS
44 HISTORY
46 *****************************************************************************/
48 AROS_LIBFUNC_INIT
50 HINIOBJECT hObject;
52 /* SANITY CHECKS */
53 if ( hIni == NULL )
54 return INI_ERROR;
55 if ( hIni->hCurObject == NULL )
56 return INI_NO_DATA;
58 hObject = hIni->hCurObject;
60 /* REMOVE ALL SUBORDINATE INFO */
61 hIni->hCurProperty = hObject->hFirstProperty;
62 while ( iniPropertyDelete( hIni ) == INI_SUCCESS )
66 /* REMOVE FROM LIST */
67 if ( hIni->hFirstObject == hObject )
68 hIni->hFirstObject = hObject->pNext;
69 if ( hIni->hLastObject == hObject )
70 hIni->hLastObject = hObject->pPrev;
72 hIni->hCurObject = NULL;
73 if ( hObject->pNext )
75 hObject->pNext->pPrev = hObject->pPrev;
76 hIni->hCurObject = hObject->pNext;
78 if ( hObject->pPrev )
80 hObject->pPrev->pNext = hObject->pNext;
81 hIni->hCurObject = hObject->pPrev;
83 hIni->nObjects--;
85 /* FREE MEMORY */
86 free( hObject );
88 iniPropertyFirst( hIni );
90 return INI_SUCCESS;
92 AROS_LIBFUNC_EXIT
93 } /* iniObjectDelete */