linked_list: Implement linked_list_take

This commit is contained in:
Kenny Levinsen 2020-08-30 00:05:19 +02:00
parent 5470c48113
commit c36cc962e6
4 changed files with 61 additions and 8 deletions

View file

@ -204,14 +204,8 @@ static int queue_event(struct backend_seatd *backend, int opcode) {
}
static void execute_events(struct backend_seatd *backend) {
struct linked_list list = {
.next = backend->pending_events.next,
.prev = backend->pending_events.prev,
};
list.next->prev = &list;
list.prev->next = &list;
linked_list_init(&backend->pending_events);
struct linked_list list;
linked_list_take(&list, &backend->pending_events);
while (!linked_list_empty(&list)) {
struct pending_event *ev = (struct pending_event *)list.next;
int opcode = ev->opcode;