# HG changeset patch # User Matti Hamalainen # Date 1423265960 -7200 # Node ID 79e904905dbf5fda35c7bcdd5452e9c44989d66b # Parent e96c900ca6f15c98a72d914b9590f342765acba7# Parent 23a79bd6c9d6c77592fefe85d6e4d175aa6a767f Merged. diff -r e96c900ca6f1 -r 79e904905dbf th_config.c --- 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; diff -r e96c900ca6f1 -r 79e904905dbf th_config.h --- 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; diff -r e96c900ca6f1 -r 79e904905dbf th_util.c