Go to the source code of this file.
Defines | |
| #define | remove_from_list(elem) |
| Remove an element from list. | |
| #define | insert_at_head(list, elem) |
| Insert an element to the list head. | |
| #define | insert_at_tail(list, elem) |
| Insert an element to the list tail. | |
| #define | move_to_head(list, elem) |
| Move an element to the list head. | |
| #define | move_to_tail(list, elem) |
| Move an element to the list tail. | |
| #define | make_empty_list(sentinal) |
| Make a empty list empty. | |
| #define | first_elem(list) ((list)->next) |
| Get list first element. | |
| #define | last_elem(list) ((list)->prev) |
| Get list last element. | |
| #define | next_elem(elem) ((elem)->next) |
| Get next element. | |
| #define | prev_elem(elem) ((elem)->prev) |
| Get previous element. | |
| #define | at_end(list, elem) ((elem) == (list)) |
| Test whether element is at end of the list. | |
| #define | is_empty_list(list) ((list)->next == (list)) |
| Test if a list is empty. | |
| #define | foreach(ptr, list) for( ptr=(list)->next ; ptr!=list ; ptr=(ptr)->next ) |
| Walk through the elements of a list. | |
| #define | foreach_s(ptr, t, list) for(ptr=(list)->next,t=(ptr)->next; list != ptr; ptr=t, t=(t)->next) |
| Walk through the elements of a list. | |
Test whether element is at end of the list.
| list | list. | |
| elem | element. |
Definition at line 158 of file u_simple_list.h.
Get list first element.
| list | list. |
Definition at line 121 of file u_simple_list.h.
Walk through the elements of a list.
| ptr | pointer to the current element. | |
| list | list. |
for loop. Definition at line 178 of file u_simple_list.h.
| #define foreach_s | ( | ptr, | |||
| t, | |||||
| list | ) | for(ptr=(list)->next,t=(ptr)->next; list != ptr; ptr=t, t=(t)->next) |
Walk through the elements of a list.
Same as foreach but lets you unlink the current value during a list traversal. Useful for freeing a list, element by element.
| ptr | pointer to the current element. | |
| t | temporary pointer. | |
| list | list. |
for loop. Definition at line 194 of file u_simple_list.h.
| #define insert_at_head | ( | list, | |||
| elem | ) |
| #define insert_at_tail | ( | list, | |||
| elem | ) |
Test if a list is empty.
| list | list. |
Definition at line 167 of file u_simple_list.h.
Get list last element.
| list | list. |
Definition at line 130 of file u_simple_list.h.
| #define make_empty_list | ( | sentinal | ) |
Value:
do { \ (sentinal)->next = sentinal; \ (sentinal)->prev = sentinal; \ } while (0)
| sentinal | list (sentinal element). |
Definition at line 108 of file u_simple_list.h.
| #define move_to_head | ( | list, | |||
| elem | ) |
Value:
do { \ remove_from_list(elem); \ insert_at_head(list, elem); \ } while (0)
| list | list. | |
| elem | element to move. |
Definition at line 85 of file u_simple_list.h.
| #define move_to_tail | ( | list, | |||
| elem | ) |
Value:
do { \ remove_from_list(elem); \ insert_at_tail(list, elem); \ } while (0)
| list | list. | |
| elem | element to move. |
Definition at line 97 of file u_simple_list.h.
| #define next_elem | ( | elem | ) | ((elem)->next) |
Get next element.
| elem | element. |
Definition at line 139 of file u_simple_list.h.
| #define prev_elem | ( | elem | ) | ((elem)->prev) |
Get previous element.
| elem | element. |
Definition at line 148 of file u_simple_list.h.
| #define remove_from_list | ( | elem | ) |
Value:
do { \ (elem)->next->prev = (elem)->prev; \ (elem)->prev->next = (elem)->next; \ } while (0)
| elem | element to remove. |
Definition at line 45 of file u_simple_list.h.
1.5.4