6 * tlist - typesafe double linked list routines
8 * The list header contains routines for manipulating double linked lists;
9 * this extends it so you can create list head types which only accomodate
10 * a specific entry type.
16 * #include <ccan/tlist/tlist.h>
18 * TLIST_TYPE(children, struct child);
21 * unsigned int num_children;
22 * struct tlist_children children;
27 * struct list_node list;
30 * int main(int argc, char *argv[])
37 * errx(1, "Usage: %s parent children...", argv[0]);
40 * tlist_init(&p.children);
41 * for (i = 2; i < argc; i++) {
42 * c = malloc(sizeof(*c));
44 * tlist_add(&p.children, c, list);
48 * printf("%s has %u children:", p.name, p.num_children);
49 * tlist_for_each(&p.children, c, list)
50 * printf("%s ", c->name);
56 * Author: Rusty Russell <rusty@rustcorp.com.au>
58 int main(int argc, char *argv[])
63 if (strcmp(argv[1], "depends") == 0) {
64 printf("ccan/list\n");
65 printf("ccan/tcon\n");