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 | * iniPropertyDelete |
19 | * |
20 | ******************************/ |
21 | int iniPropertyDelete( HINI hIni ) |
22 | { |
23 | HINIPROPERTY hProperty; |
24 | HINIOBJECT hObject; |
25 | |
26 | /* SANITY CHECKS */ |
27 | if ( hIni == NULL ) |
28 | return INI_ERROR; |
29 | if ( hIni->hCurObject == NULL ) |
30 | return INI_ERROR; |
31 | if ( hIni->hCurProperty == NULL ) |
32 | return INI_NO_DATA; |
33 | |
34 | hObject = hIni->hCurObject; |
35 | hProperty = hIni->hCurProperty; |
36 | |
37 | if ( hObject->hFirstProperty == hProperty ) |
38 | hObject->hFirstProperty = hProperty->pNext; |
39 | if ( hObject->hLastProperty == hProperty ) |
40 | hObject->hLastProperty = hProperty->pPrev; |
41 | |
42 | hIni->hCurProperty = NULL; |
43 | if ( hProperty->pNext ) |
44 | { |
45 | hProperty->pNext->pPrev = hProperty->pPrev; |
46 | hIni->hCurProperty = hProperty->pNext; |
47 | } |
48 | if ( hProperty->pPrev ) |
49 | { |
50 | hProperty->pPrev->pNext = hProperty->pNext; |
51 | hIni->hCurProperty = hProperty->pPrev; |
52 | } |
53 | hObject->nProperties--; |
54 | |
55 | /* FREE MEMORY */ |
56 | free( hProperty ); |
57 | |
58 | return INI_SUCCESS; |
59 | } |
60 | |
61 | |
62 |