diff --git a/src/util-list.c b/src/util-list.c index 45fed457..900172d2 100644 --- a/src/util-list.c +++ b/src/util-list.c @@ -34,8 +34,7 @@ void list_init(struct list *list) { - list->prev = list; - list->next = list; + *list = LIST_INIT(*list); } void diff --git a/src/util-list.h b/src/util-list.h index a9f0c87b..bc710a9c 100644 --- a/src/util-list.h +++ b/src/util-list.h @@ -62,6 +62,8 @@ struct list { struct list *next; }; +#define LIST_INIT(l) (struct list){ .prev = &(l), .next = &(l) } + /** * Initialize a list head. This function *must* be called once for each list * head. This function *must not* be called for a node to be added to a