summaryrefslogtreecommitdiffstats
path: root/lib/lists.h
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2001-01-15 10:24:16 +0100
committerMartin Mares <mj@ucw.cz>2001-01-15 10:24:16 +0100
commita2d01907c5b24bab78cc055fa23354597bd44a03 (patch)
tree0683dcec477a67f73dedbfaf1e46262616777f56 /lib/lists.h
parent8c6ce98b9d9b5c4970e902cf667c1ffb64f04a62 (diff)
downloadbird-a2d01907c5b24bab78cc055fa23354597bd44a03.tar
bird-a2d01907c5b24bab78cc055fa23354597bd44a03.zip
Added an explanatory comment.
Diffstat (limited to 'lib/lists.h')
-rw-r--r--lib/lists.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/lists.h b/lib/lists.h
index acab292..5b36ec8 100644
--- a/lib/lists.h
+++ b/lib/lists.h
@@ -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;