From: Olivier Houchard Date: Wed, 11 Mar 2020 13:57:52 +0000 (+0100) Subject: MINOR: lists: Implement function to convert list => mt_list and mt_list => list X-Git-Tag: v2.2-dev5~80 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=751e5e21a9b9228dc035bd4c65fe65a043b31f77;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/include/common/mini-clist.h b/include/common/mini-clist.h index a7b5a5dd87..40baf5d2b5 100644 --- a/include/common/mini-clist.h +++ b/include/common/mini-clist.h @@ -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 */