]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
include/list: add a macro for initializing list_head a declarative way
authorMasatake YAMATO <yamato@redhat.com>
Sun, 9 Mar 2025 21:52:19 +0000 (06:52 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Fri, 14 Mar 2025 14:26:23 +0000 (23:26 +0900)
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
include/list.h

index b6bbbdd8fef7020ffea3ca77b0c4e194d460ac6a..b4597570313c01aa614f8f986b50b794724e4327 100644 (file)
@@ -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)