0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-23 02:01:55 +00:00

Typed list: macro for list length

This commit is contained in:
Maria Matejka 2024-03-21 23:37:04 +01:00
parent 59304b2f91
commit 76e43b405f

View File

@ -231,5 +231,8 @@ static inline void TLIST_NAME(rem_node)(TLIST_LIST_STRUCT *list, TLIST_TYPE *nod
/* Empty check */ /* Empty check */
#define EMPTY_TLIST(_name, _list) (!(_list)->first) #define EMPTY_TLIST(_name, _list) (!(_list)->first)
/* List length */
#define TLIST_LENGTH(_name, _list) ({ uint _len = 0; WALK_TLIST(_name, _, _list) _len++; _len; })
#endif #endif