From f0714312661073c7b809c886ab078f48f4ce3ac9 Mon Sep 17 00:00:00 2001 From: tokyo4j Date: Thu, 21 Nov 2024 03:39:16 +0900 Subject: [PATCH] common/list: add WL_LIST_INIT() macro --- include/common/list.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/common/list.h b/include/common/list.h index 37d4b72f..74c6911e 100644 --- a/include/common/list.h +++ b/include/common/list.h @@ -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 */