42 #include "lib/circular-list.h" 73 for(
this = *cl; this->next != *cl;
this = this->next);
81 struct cl *
this, *previous;
93 this = previous->next;
97 previous->next = this->next;
98 *cl = this->next ==
this ? NULL : previous;
103 }
while(
this != ((
struct cl *)*cl)->next);
111 if(element == NULL) {
122 ((
struct cl *)element)->next = element;
126 ((
struct cl *)element)->next = head->next;
127 head->next = element;
137 unsigned long len = 1;
144 for(
this = *cl; this->next != *cl;
this = this->next) {
154 return *cl == NULL ? true :
false;
void circular_list_init(circular_list_t cl)
Initialise a circular, singly-linked list.
unsigned long circular_list_length(circular_list_t cl)
Get the length of a circular, singly-linked list.
void * circular_list_head(circular_list_t cl)
Return the tail of a circular, singly-linked list.
void circular_list_add(circular_list_t cl, void *element)
Add an element to a circular, singly-linked list.
void * circular_list_tail(circular_list_t cl)
Return the tail of a circular, singly-linked list.
bool circular_list_is_empty(circular_list_t cl)
Determine whether a circular, singly-linked list is empty.
void ** circular_list_t
The circular, singly-linked list datatype.
void circular_list_remove(circular_list_t cl, void *element)
Remove an element from a circular, singly-linked list.