mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-04-05 11:20:42 +02:00
util: add a LIST_INIT macro
Necessary for the case where we need a compile-time initialized list. Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/984>
This commit is contained in:
parent
3a935507ae
commit
4935e52652
2 changed files with 3 additions and 2 deletions
|
|
@ -34,8 +34,7 @@
|
|||
void
|
||||
list_init(struct list *list)
|
||||
{
|
||||
list->prev = list;
|
||||
list->next = list;
|
||||
*list = LIST_INIT(*list);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue