]> git.ozlabs.org Git - petitboot/blobdiff - lib/list/list.c
Initial support for multiple UIs
[petitboot] / lib / list / list.c
diff --git a/lib/list/list.c b/lib/list/list.c
new file mode 100644 (file)
index 0000000..d9bc532
--- /dev/null
@@ -0,0 +1,24 @@
+
+#include "list/list.h"
+
+void list_init(struct list *list)
+{
+       list->head.next = &list->head;
+       list->head.prev = &list->head;
+}
+
+void list_add(struct list *list, struct list_item *new)
+{
+       new->next = list->head.next;
+       new->prev = &list->head;
+
+       list->head.next->prev = new;
+       list->head.next = new;
+}
+
+void list_remove(struct list_item *item)
+{
+       item->next->prev = item->prev;
+       item->prev->next = item->next;
+}
+