diff --git a/include/nickel/linkedlist.h b/include/nickel/linkedlist.h index 5256d0c..d91a018 100644 --- a/include/nickel/linkedlist.h +++ b/include/nickel/linkedlist.h @@ -1,9 +1,11 @@ -#include -#include - #ifndef __NICKEL_LINKEDLIST_H_ #define __NICKEL_LINKEDLIST_H_ +#include +#include +#include +#include + typedef struct ni_list_node { struct ni_list_node* next; struct ni_list_node* prev; @@ -46,10 +48,10 @@ static inline ni_list_node* ni_list__get_back(ni_list* l) { /* Iter Helpers */ #define NI_LIST__FOREACH(lptr) \ - for (ni_list_node* it = ni_list__get_front(lptr); it != &(lptr)->head; it = it->next) + for (ni_list_node* it = (lptr)->head.next; it != &(lptr)->head; it = it->next) #define NI_LIST_FOREACH_SAFE(tmp, lptr) \ - for (ni_list_node* it = ni_list__get_front(lptr), *tmp = it->next; \ + for (ni_list_node* it = (lptr)->head.next, *tmp = it->next; \ it != &(lptr)->head; \ it = tmp, tmp = it-> next)