]> git.ipfire.org Git - thirdparty/bird.git/blobdiff - lib/lists.h
Filter test: typo fix
[thirdparty/bird.git] / lib / lists.h
index 37c56efbc43839a2593e00759d60c93a478ba96f..51856b053cdbf6e0c2158cb544233c5026fa8a24 100644 (file)
@@ -26,10 +26,23 @@ typedef struct node {
   struct node *next, *prev;
 } node;
 
-typedef struct list {                  /* In fact two overlayed nodes */
-  struct node *head, *null, *tail;
+typedef union list {                   /* In fact two overlayed nodes */
+  struct {                             /* Head node */
+    struct node head_node;
+    void *head_padding;
+  };
+  struct {                             /* Tail node */
+    void *tail_padding;
+    struct node tail_node;
+  };
+  struct {                             /* Split to separate pointers */
+    struct node *head;
+    struct node *null;
+    struct node *tail;
+  };
 } list;
 
+
 #define NODE (node *)
 #define HEAD(list) ((void *)((list).head))
 #define TAIL(list) ((void *)((list).tail))
@@ -50,20 +63,20 @@ typedef struct list {                       /* In fact two overlayed nodes */
 
 #define EMPTY_LIST(list) (!(list).head->next)
 
+
+#ifndef _BIRD_LISTS_C_
+#define LIST_INLINE static inline
+#include "lib/lists.c"
+#undef LIST_INLINE
+
+#else /* _BIRD_LISTS_C_ */
+#define LIST_INLINE
 void add_tail(list *, node *);
 void add_head(list *, node *);
 void rem_node(node *);
-void rem2_node(node *);
 void add_tail_list(list *, list *);
 void init_list(list *);
 void insert_node(node *, node *);
-
-#ifndef _BIRD_LISTS_C_
-#define LIST_INLINE extern inline
-#include "lib/lists.c"
-#undef LIST_INLINE
-#else
-#define LIST_INLINE
 #endif
 
 #endif