#include "doublelinkedlist.h" #include #include struct in { int low; int max; struct list next; }; int main() { struct in tmp; struct in tmp2; struct in tmp3; struct in tmp4; struct list *iter, *head; tmp.low = 1; tmp.max = 3; tmp2.low = 5; tmp2.max = 9; tmp3.low = 14; tmp3.max = 16; tmp4.low = 23; tmp4.max = 35; LIST_INIT(&tmp.next); LIST_INIT(&tmp2.next); LIST_INIT(&tmp3.next); LIST_INIT(&tmp4.next); list_insert_after(&tmp.next, &tmp2.next); list_insert_after(&tmp2.next, &tmp3.next); list_insert_after(&tmp3.next, &tmp4.next); head = &tmp2.next; LIST_TO_END(iter, head) { struct in *i = CONTAINER_OF(iter, struct in, next); printf("low: %i, max: %i\n", i->low, i->max); } list_delete(&tmp4.next); LIST_TO_END(iter, head) { struct in *i = CONTAINER_OF(iter, struct in, next); printf("low: %i, max: %i\n", i->low, i->max); } }