common/list: add WL_LIST_INIT() macro

This commit is contained in:
tokyo4j 2024-11-21 03:39:16 +09:00 committed by Johan Malm
parent 71b4277852
commit f071431266

View file

@ -20,4 +20,13 @@ wl_list_append(struct wl_list *list, struct wl_list *elm)
wl_list_insert(list->prev, elm);
}
/**
* WL_LIST_INIT() - initialize a list when defining it
* @head: pointer to the head of the list to be initialized
*
* For example, this can be used like this:
* static struct wl_list list = WL_LIST_INIT(&list);
*/
#define WL_LIST_INIT(head) {.prev = (head), .next = (head)}
#endif /* LABWC_LIST_H */