1 | /********************************************************************************** |
---|---|
2 | * . |
3 | * |
4 | * |
5 | ************************************************** |
6 | * This code was created by Peter Harvey @ CodeByDesign. |
7 | * Released under LGPL 28.JAN.99 |
8 | * |
9 | * Contributions from... |
10 | * ----------------------------------------------- |
11 | * Peter Harvey - pharvey@codebydesign.com |
12 | **************************************************/ |
13 | |
14 | #include <config.h> |
15 | #include "ini.h" |
16 | |
17 | /****************************** |
18 | * iniObjectDelete |
19 | * |
20 | ******************************/ |
21 | int iniObjectDelete( HINI hIni ) |
22 | { |
23 | HINIOBJECT hObject; |
24 | |
25 | /* SANITY CHECKS */ |
26 | if ( hIni == NULL ) |
27 | return INI_ERROR; |
28 | if ( hIni->hCurObject == NULL ) |
29 | return INI_NO_DATA; |
30 | |
31 | hObject = hIni->hCurObject; |
32 | |
33 | /* REMOVE ALL SUBORDINATE INFO */ |
34 | hIni->hCurProperty = hObject->hFirstProperty; |
35 | while ( iniPropertyDelete( hIni ) == INI_SUCCESS ) |
36 | { |
37 | } |
38 | |
39 | /* REMOVE FROM LIST */ |
40 | if ( hIni->hFirstObject == hObject ) |
41 | hIni->hFirstObject = hObject->pNext; |
42 | if ( hIni->hLastObject == hObject ) |
43 | hIni->hLastObject = hObject->pPrev; |
44 | |
45 | hIni->hCurObject = NULL; |
46 | if ( hObject->pNext ) |
47 | { |
48 | hObject->pNext->pPrev = hObject->pPrev; |
49 | hIni->hCurObject = hObject->pNext; |
50 | } |
51 | if ( hObject->pPrev ) |
52 | { |
53 | hObject->pPrev->pNext = hObject->pNext; |
54 | hIni->hCurObject = hObject->pPrev; |
55 | } |
56 | hIni->nObjects--; |
57 | |
58 | /* FREE MEMORY */ |
59 | free( hObject ); |
60 | |
61 | iniPropertyFirst( hIni ); |
62 | |
63 | return INI_SUCCESS; |
64 | } |
65 | |
66 | |
67 |