Mercurial > code
diff ini.h @ 142:e3cf5ac9a5aa
[p]array_insert now returns -1 or index of added element
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 08 May 2012 15:02:17 +0200 |
parents | 07800b7af208 |
children | 0cf53c588a83 |
line wrap: on
line diff
--- a/ini.h Wed May 02 20:20:22 2012 +0200 +++ b/ini.h Tue May 08 15:02:17 2012 +0200 @@ -34,6 +34,20 @@ typedef void (*INI_ConvertFunc)(void *, const char *, void *); +#if !defined(LIST_ENTRY) +#define LIST_ENTRY(type) \ +struct { \ + struct type *le_next; \ + struct type **le_prev; \ +} +#endif + +#if !define(LIST_HEAD) +#define LIST_HEAD(name, type) \ +struct name { \ + struct type *lh_first; +} + /* -------------------------------------------------------- * Structure definitions * -------------------------------------------------------- */ @@ -61,7 +75,8 @@ struct ini_option { char *key; /* (rw) option name */ char *value; /* (rw) option value */ - INI_Option *next; /* (ro) next option */ + + LIST_ENTRY(ini_option) link; /* (rw) link entry */ }; struct ini_section {