0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-13 22:58:42 +00:00

Typed lists: shortcut for simple nodes

This commit is contained in:
Maria Matejka 2023-01-31 14:30:35 +01:00
parent e077d0e770
commit 6e035a9a8c

View 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" #error "You should first include lib/tlists.h without requesting a TLIST"
#endif #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 #define TLIST_LIST(_name) struct _name##_list
/* Use ->first and ->last to access HEAD and TAIL */ /* Use ->first and ->last to access HEAD and TAIL */
#define THEAD(_name, _list) (_list)->first #define THEAD(_name, _list) (_list)->first
#define TTAIL(_name, _list) (_list)->last #define TTAIL(_name, _list) (_list)->last