From: Martin Mares Date: Mon, 15 Jan 2001 09:36:26 +0000 (+0000) Subject: Added an explanatory comment. X-Git-Tag: holmes-import~1587 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=1f578af595de63a577b13f0c7adc8693a6645d94;p=libucw.git Added an explanatory comment. --- diff --git a/lib/lists.h b/lib/lists.h index 0c0ab0f6..fa9599aa 100644 --- a/lib/lists.h +++ b/lib/lists.h @@ -7,6 +7,19 @@ #ifndef _SHERLOCK_LISTS_H #define _SHERLOCK_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;