X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Fsimple-lists.h;h=64b819013bba01fb8c64a086357118f9c448c09d;hb=d84b9fd101d2bf3a72b9dc1d603c9b3960e8cb17;hp=e8bf62513218b7bf7bf3a303777d451c7db571eb;hpb=031256ad2e123eec58521f8e3eb9496c197641d2;p=libucw.git diff --git a/ucw/simple-lists.h b/ucw/simple-lists.h index e8bf6251..64b81901 100644 --- a/ucw/simple-lists.h +++ b/ucw/simple-lists.h @@ -12,6 +12,16 @@ #include "ucw/clists.h" +/*** + * To simplify very common usage of circular linked links, whose nodes can hold only one or two trivial values, + * we define some generic node types, called the simple nodes. + * + * To avoid some type casts, values in simple nodes are defined as unions of most frequent types. + ***/ + +/** + * Simple node with one value. + **/ typedef struct simp_node { cnode n; union { @@ -22,6 +32,9 @@ typedef struct simp_node { }; } simp_node; +/** + * Simple node with two values. + **/ typedef struct simp2_node { cnode n; union { @@ -39,11 +52,27 @@ typedef struct simp2_node { } simp2_node; struct mempool; + +/** + * Allocate a new one-value node on memory pool @mp and insert it to @l. The value is undefined and should be changed afterwards. + **/ simp_node *simp_append(struct mempool *mp, clist *l); + +/** + * Allocate a new two-value node on memory pool @mp and insert it to @l. The values are undefined and should be changed afterwards. + **/ simp2_node *simp2_append(struct mempool *mp, clist *l); /* Configuration sections */ + +/** + * Default definition of the configuration section with one-value string node. Identifier of the value is `String`. + **/ extern struct cf_section cf_string_list_config; + +/** + * Default definition of the configuration section with two-value string node. Identifiers of the values are `Src` and `Dest`. + **/ extern struct cf_section cf_2string_list_config; #endif