Mercurial > hg > th-libs
changeset 158:79e904905dbf
Merged.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 07 Feb 2015 01:39:20 +0200 |
parents | e96c900ca6f1 (current diff) 23a79bd6c9d6 (diff) |
children | fc914ff7a9b8 |
files | th_util.c |
diffstat | 2 files changed, 7 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/th_config.c Sat Feb 07 01:37:58 2015 +0200 +++ b/th_config.c Sat Feb 07 01:39:20 2015 +0200 @@ -22,7 +22,7 @@ while (node != NULL) { - th_cfgitem_t *next = node->next; + th_cfgitem_t *next = (th_cfgitem_t *) node->node.next; if (node->type == ITEM_SECTION) th_cfg_free((th_cfgitem_t *) node->v.data); @@ -55,18 +55,7 @@ node->name = th_strdup(name); // Insert into linked list - if (*cfg != NULL) - { - node->prev = (*cfg)->prev; - (*cfg)->prev->next = node; - (*cfg)->prev = node; - } - else - { - *cfg = node; - node->prev = node; - } - node->next = NULL; + th_llist_append_node((th_llist_t **) cfg, (th_llist_t *) node); return node; } @@ -362,7 +351,7 @@ if (item->name != NULL && strcmp(item->name, tmpStr) == 0) isFound = TRUE; else - item = item->next; + item = (th_cfgitem_t *) item->node.next; } // Check if key was found @@ -802,7 +791,7 @@ break; } } - item = item->next; + item = (th_cfgitem_t *) item->node.next; } return 0;
--- a/th_config.h Sat Feb 07 01:37:58 2015 +0200 +++ b/th_config.h Sat Feb 07 01:39:20 2015 +0200 @@ -8,6 +8,7 @@ #ifndef TH_CONFIG_H #define TH_CONFIG_H +#include "th_util.h" #include "th_ioctx.h" #ifdef __cplusplus @@ -34,6 +35,8 @@ typedef struct _th_cfgitem_t { + th_llist_t node; + int type; char *name; union { @@ -46,8 +49,6 @@ th_llist_t **list; struct _th_cfgitem_t *section; } v; - - struct _th_cfgitem_t *next, *prev; } th_cfgitem_t;