From: Masatake YAMATO Date: Sun, 9 Mar 2025 21:52:19 +0000 (+0900) Subject: include/list: add a macro for initializing list_head a declarative way X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cafae2d19742ad56a05a51bb23b798dbbd5c62a8;p=thirdparty%2Futil-linux.git include/list: add a macro for initializing list_head a declarative way Signed-off-by: Masatake YAMATO --- diff --git a/include/list.h b/include/list.h index b6bbbdd8f..b45975703 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)