#include #include #include #include "libaco/aco.h" struct aco_list { aco_t *co; int fd; struct aco_list *next, *prev; }; struct aco_list *aco_list_new () { struct aco_list *head = malloc (sizeof (struct aco_list)); memset (head, 0, sizeof (struct aco_list)); head->next = head->prev = head; return head; } struct aco_list *aco_list_add (struct aco_list *head, aco_t *co) { struct aco_list *node = malloc (sizeof (struct aco_list)); node->co = co; node->prev = head->prev; node->next = head; head->prev = node; return node; } void aco_list_remove (struct aco_list *iter) { if (iter->next == iter) abort(); iter->prev->next = iter->next; iter->next->prev = iter->prev; }