--- libaitcfg/inc/aitcfg.h 2013/05/26 19:52:29 1.10.4.2 +++ libaitcfg/inc/aitcfg.h 2014/03/03 09:41:09 1.14 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitcfg.h,v 1.10.4.2 2013/05/26 19:52:29 misho Exp $ +* $Id: aitcfg.h,v 1.14 2014/03/03 09:41:09 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -12,7 +12,7 @@ terms: All of the documentation and software included in the ELWIX and AITNET Releases is copyrighted by ELWIX - Sofia/Bulgaria -Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 +Copyright 2004 - 2014 by Michael Pounov . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -56,13 +56,14 @@ struct tagCfg { ait_val_t cfg_attr; ait_val_t cfg_val; - SLIST_ENTRY(tagCfg) cfg_next; + TAILQ_ENTRY(tagCfg) cfg_next; RB_ENTRY(tagCfg) cfg_node; }; typedef struct tagRC { pthread_mutex_t rc_mtx; - struct tagCfg *slh_first; + struct tagCfg *tqh_first; + struct tagCfg **tqh_last; struct tagCfg *rbh_root; } cfg_root_t; #define CFG_RC_LOCK(x) pthread_mutex_lock(&(x)->rc_mtx) @@ -70,9 +71,9 @@ typedef struct tagRC { // cfg_GetErrno() Get error code of last operation -inline int cfg_GetErrno(); +int cfg_GetErrno(); // cfg_GetError() Get error text of last operation -inline const char *cfg_GetError(); +const char *cfg_GetError(); /* @@ -84,10 +85,16 @@ inline const char *cfg_GetError(); /* * cfgInitConfig() - Init config root * - * @cfg = Config root - * return: -1 error or 0 ok + * return: NULL error or !=NULL allocated config root */ -int cfgInitConfig(cfg_root_t * __restrict cfg); +cfg_root_t *cfgInitConfig(); +/* + * cfgEndConfig() - Free resources & config root + * + * @pcfg = Config root + * return: none + */ +void cfgEndConfig(cfg_root_t **pcfg); /* * cfgLoadConfig() - Load config from file *