|
utils
utilities in C for microcontrollers
|
An intrusive circular doubly linked list. More...
#include <stddef.h>#include <stdbool.h>Go to the source code of this file.
Data Structures | |
| struct | list_element |
| list element state More... | |
| struct | list |
| list state More... | |
| struct | list_iterator |
| list iterator state More... | |
Macros | |
| #define | LIST_INIT(list) { .head.prev = &(list).head, .head.next = &(list).head } |
| allows static initialization of a list More... | |
Functions | |
| int | list_element_init (struct list_element *element) |
| initialize a list_element More... | |
| int | list_element_in_list (struct list_element *element, bool *in_list) |
| checks if an element is in a list More... | |
| int | list_element_insert_after (struct list_element *after, struct list_element *element) |
| insert an element after another More... | |
| int | list_element_insert_before (struct list_element *before, struct list_element *element) |
| insert an element before another More... | |
| int | list_element_remove (struct list_element *element) |
removes element from a list More... | |
| int | list_init (struct list *list) |
| initialize a list More... | |
| int | list_is_empty (struct list *list, bool *is_empty) |
| checks if a list is empty More... | |
| int | list_prepend (struct list *list, struct list_element *element) |
| prepends an element to a list More... | |
| int | list_append (struct list *list, struct list_element *element) |
| appends an element to a list More... | |
| int | list_remove (struct list *list, struct list_element *element) |
| removes an element from a list More... | |
| int | list_iterator_init (struct list_iterator *it, struct list *list) |
| initialize a list iterator More... | |
| int | list_iterator_next (struct list_iterator *it, struct list_element **element) |
| gets the next element from an iterator More... | |
| int | list_iterator_previous (struct list_iterator *it, struct list_element **element) |
| gets the previous element from an iterator More... | |
| bool | list_contains (struct list *list, struct list_element *element) |
| checks if an element is contained in a list More... | |
| int | list_clear (struct list *list) |
| removes all elments from a list More... | |
An intrusive circular doubly linked list.
| int list_append | ( | struct list * | list, |
| struct list_element * | element | ||
| ) |
appends an element to a list
| list | pointer to the list to append to |
| element | pointer to the element to append |
| int list_clear | ( | struct list * | list | ) |
removes all elments from a list
| list | the list to clear |
| bool list_contains | ( | struct list * | list, |
| struct list_element * | element | ||
| ) |
checks if an element is contained in a list
| list | the list to check |
| element | the element to look for |
element is in list, false otherwise | int list_element_in_list | ( | struct list_element * | element, |
| bool * | in_list | ||
| ) |
checks if an element is in a list
| element | the element to check for list membership | |
| [out] | in_list | pointer to location where result should be written |
| int list_element_init | ( | struct list_element * | element | ) |
| int list_element_insert_after | ( | struct list_element * | after, |
| struct list_element * | element | ||
| ) |
insert an element after another
| after | list element after which to insert |
| element | element to insert returns 0 if the insert was successful |
| int list_element_insert_before | ( | struct list_element * | before, |
| struct list_element * | element | ||
| ) |
insert an element before another
| before | element before which to insert |
| element | element to insert returns 0 if the insert was successful |
| int list_element_remove | ( | struct list_element * | element | ) |
| int list_init | ( | struct list * | list | ) |
| int list_is_empty | ( | struct list * | list, |
| bool * | is_empty | ||
| ) |
checks if a list is empty
| list | pointer to initialized list | |
| [out] | is_empty | pointer to location where result should be written |
| int list_iterator_init | ( | struct list_iterator * | it, |
| struct list * | list | ||
| ) |
initialize a list iterator
the iterator will point to one before the first element of list or, equivalently, to one after the last element of list
| it | pointer to the iterator to initialize |
| list | pointer to the list over which to iterate |
| int list_iterator_next | ( | struct list_iterator * | it, |
| struct list_element ** | element | ||
| ) |
gets the next element from an iterator
| it | the iterator from which to get the next element | |
| [out] | element | pointer to a location where the next element pointer should be written |
| int list_iterator_previous | ( | struct list_iterator * | it, |
| struct list_element ** | element | ||
| ) |
gets the previous element from an iterator
| it | the iterator from which to get the previous element | |
| [out] | element | pointer to a location where the previous element pointer should be written |
| int list_prepend | ( | struct list * | list, |
| struct list_element * | element | ||
| ) |
prepends an element to a list
| list | pointer to the list on which to prepend |
| element | pointer to element to prepend |
| int list_remove | ( | struct list * | list, |
| struct list_element * | element | ||
| ) |
removes an element from a list
| list | the list from which to remove |
| element | the element to remove |
1.8.14