MINOR: lists: Implement function to convert list => mt_list and mt_list => list

Implement mt_list_to_list() and list_to_mt_list(), to be able to convert
from a struct list to a struct mt_list, and vice versa.
This is normally of no use, except for struct connection's list field, that
can go in either a struct list or a struct mt_list.
This commit is contained in:
Olivier Houchard 2020-03-11 14:57:52 +01:00 committed by Olivier Houchard
parent 49983a9fe1
commit 751e5e21a9

View File

@ -662,4 +662,28 @@ struct cond_wordlist {
} \
}), \
&item->member != (list_head);)
static __inline struct list *mt_list_to_list(struct mt_list *list)
{
union {
struct mt_list *mt_list;
struct list *list;
} mylist;
mylist.mt_list = list;
return mylist.list;
}
static __inline struct mt_list *list_to_mt_list(struct list *list)
{
union {
struct mt_list *mt_list;
struct list *list;
} mylist;
mylist.list = list;
return mylist.mt_list;
}
#endif /* _COMMON_MINI_CLIST_H */