From 90428c4cc95d11c74871a92e3e7a340195d0997b Mon Sep 17 00:00:00 2001 From: Geoff Levand Date: Fri, 11 Nov 2011 22:28:50 -0800 Subject: [PATCH] Add STATIC_LIST initializer Signed-off-by: Geoff Levand --- lib/list/list.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/list/list.h b/lib/list/list.h index 53080a0..c8c5631 100644 --- a/lib/list/list.h +++ b/lib/list/list.h @@ -34,6 +34,13 @@ struct list { for (; &_pos->_member != &(_list)->head; \ _pos = list_entry(_pos->_member.next, typeof(*_pos), _member)) +#define STATIC_LIST(_list) static struct list _list = { \ + .head = { \ + .next = &_list.head, \ + .prev = &_list.head \ + } \ +} + void list_init(struct list *list); void list_insert_before(struct list_item *next, struct list_item *item); void list_insert_after(struct list_item *prev, struct list_item *item); -- 2.39.2