]> mj.ucw.cz Git - libucw.git/blobdiff - lib/lists.h
Initial version of SQL gathering utility gsql added.
[libucw.git] / lib / lists.h
index ce03656b10bc7eedc00d9ef5586ad9b0b1a0e34d..fa9599aa9f8e943b527d9d200ea3e686d3bcb158 100644 (file)
@@ -1,12 +1,25 @@
 /*
  *     Sherlock Library -- Linked Lists
  *
- *     (c) 1997--1999 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
+ *     (c) 1997--1999 Martin Mares <mj@ucw.cz>
  */
 
 #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;
@@ -38,7 +51,7 @@ void init_list(list *);
 void insert_node(node *, node *);
 
 #if !defined(_SHERLOCK_LISTS_C) && defined(__GNUC__)
-#define LIST_INLINE static inline
+#define LIST_INLINE extern inline
 #include "lib/lists.c"
 #undef LIST_INLINE
 #else