Files
stutterfuzz/list.c

25 lines
503 B
C
Raw Normal View History

2016-03-04 13:37:23 -08:00
#include <stdlib.h>
#include "list.h"
void list_head_init(struct list_head *head) {
head->next = head->prev = head;
}
bool list_is_empty(const struct list_head *head) {
return head->next == head;
}
void list_add(struct list_head *new, struct list_head *head) {
new->next = head;
new->prev = head->prev;
new->prev->next = new;
head->prev = new;
}
void list_del(struct list_head *entry) {
entry->next->prev = entry->prev;
entry->prev->next = entry->next;
entry->prev = entry->next = NULL;
}