From cafae2d19742ad56a05a51bb23b798dbbd5c62a8 Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Mon, 10 Mar 2025 06:52:19 +0900 Subject: [PATCH] include/list: add a macro for initializing list_head a declarative way Signed-off-by: Masatake YAMATO --- include/list.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/list.h b/include/list.h index b6bbbdd8fe..b459757031 100644 --- a/include/list.h +++ b/include/list.h @@ -35,6 +35,9 @@ struct list_head { struct list_head *next, *prev; }; +#define LIST_HEAD(name) \ + struct list_head name = { .next = &(name), .prev = &(name) } + #define INIT_LIST_HEAD(ptr) do { \ (ptr)->next = (ptr); (ptr)->prev = (ptr); \ } while (0) -- 2.47.3