]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Added an explanatory comment.
authorMartin Mares <mj@ucw.cz>
Mon, 15 Jan 2001 09:24:16 +0000 (09:24 +0000)
committerMartin Mares <mj@ucw.cz>
Mon, 15 Jan 2001 09:24:16 +0000 (09:24 +0000)
lib/lists.h

index acab292e919080d7f1c36a2eee776ba94ccbdbb7..5b36ec83e7bbab008a2c231e406d473fcf856b51 100644 (file)
@@ -9,6 +9,19 @@
 #ifndef _BIRD_LISTS_H_
 #define _BIRD_LISTS_H_
 
+/*
+ * I admit the list structure is very tricky and also somewhat awkward,
+ * but it's both efficient and easy to manipulate once one understands the
+ * basic trick: The list head always contains two synthetic nodes which are
+ * always present in the list: the head and the tail. But as the `next'
+ * entry of the tail and the `prev' entry of the head are both NULL, the
+ * nodes can overlap each other:
+ *
+ *     head    head_node.next
+ *     null    head_node.prev  tail_node.next
+ *     tail                    tail_node.prev
+ */
+
 typedef struct node {
   struct node *next, *prev;
 } node;