]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Typed lists: shortcut for simple nodes
authorMaria Matejka <mq@ucw.cz>
Tue, 31 Jan 2023 13:30:35 +0000 (14:30 +0100)
committerMaria Matejka <mq@ucw.cz>
Mon, 5 Jun 2023 16:14:30 +0000 (18:14 +0200)
lib/tlists.h

index e1ed79ea4f8b7080f109db21d8667085dfd6d627..1437e17e48e7a27138015fc2ff41945a0e97bd42 100644 (file)
@@ -147,9 +147,14 @@ static inline void TLIST_NAME(rem_node)(TLIST_LIST_STRUCT *list, TLIST_TYPE *nod
 #error "You should first include lib/tlists.h without requesting a TLIST"
 #endif
 
-#define TLIST_NODE(_name, _type)       struct _name##_node { _type *next; _type *prev; }
+#define TLIST_NODE_CONTENTS(_type)     { _type *next; _type *prev; }
+#define TLIST_NODE(_name, _type)       struct _name##_node TLIST_NODE_CONTENTS(_type) 
+#define TLIST_DEFAULT_NODE             struct MACRO_CONCAT_AFTER(TLIST_PREFIX,_node) \
+                                       TLIST_NODE_CONTENTS(TLIST_TYPE) TLIST_ITEM
+
 #define TLIST_LIST(_name)              struct _name##_list 
 
+
 /* Use ->first and ->last to access HEAD and TAIL */
 #define THEAD(_name, _list)  (_list)->first
 #define TTAIL(_name, _list)  (_list)->last