|
utils
utilities in C for microcontrollers
|
An intrusive singly linked list. More...
#include <stddef.h>#include <stdbool.h>Go to the source code of this file.
Data Structures | |
| struct | slist_element |
| slist element state More... | |
| struct | slist |
| slist state More... | |
| struct | slist_iterator |
| slist iterator state More... | |
Functions | |
| int | slist_element_init (struct slist_element *element) |
| initialize a slist_element More... | |
| int | slist_element_insert_after (struct slist_element *after, struct slist_element *element) |
| insert an element after another More... | |
| int | slist_element_remove_after (struct slist_element *after) |
| removes an element following another More... | |
| int | slist_init (struct slist *list) |
| initialize an slist More... | |
| int | slist_is_empty (struct slist *list, bool *is_empty) |
| checks if a list is empty More... | |
| int | slist_prepend (struct slist *list, struct slist_element *element) |
| prepends element to list More... | |
| int | slist_append (struct slist *list, struct slist_element *element) |
| appends an element to a list More... | |
| int | slist_remove (struct slist *list, struct slist_element *element) |
| removes an element from a list More... | |
| int | slist_remove_head (struct slist *list, struct slist_element **element) |
| removes the first element from a list More... | |
| int | slist_iterator_init (struct slist_iterator *it, struct slist *list) |
| initialize a list iterator More... | |
| int | slist_iterator_next (struct slist_iterator *it, struct slist_element **element) |
| gets the next element from an iterator More... | |
An intrusive singly linked list.
| int slist_append | ( | struct slist * | list, |
| struct slist_element * | element | ||
| ) |
appends an element to a list
| list | the list on which to append |
| element | the element to append |
If element is part of a list then that list will be corrupted. The runtime of this function is linear in the length of list.
| int slist_element_init | ( | struct slist_element * | element | ) |
initialize a slist_element
| element | pointer to element to initialize |
| int slist_element_insert_after | ( | struct slist_element * | after, |
| struct slist_element * | element | ||
| ) |
insert an element after another
| after | the element after which to insert |
| element | the element to insert |
| int slist_element_remove_after | ( | struct slist_element * | after | ) |
removes an element following another
| after | the element after which to remove |
| int slist_init | ( | struct slist * | list | ) |
| int slist_is_empty | ( | struct slist * | list, |
| bool * | is_empty | ||
| ) |
checks if a list is empty
| list | the list to check | |
| [out] | is_empty | pointer to location where result should be stored |
| int slist_iterator_init | ( | struct slist_iterator * | it, |
| struct slist * | list | ||
| ) |
initialize a list iterator
| it | the iterator to initialize |
| list | the list over which to iterate |
| int slist_iterator_next | ( | struct slist_iterator * | it, |
| struct slist_element ** | element | ||
| ) |
gets the next element from an iterator
| it | the iterator from which to get the next element | |
| [out] | element | the location at which to store the next element |
| int slist_prepend | ( | struct slist * | list, |
| struct slist_element * | element | ||
| ) |
prepends element to list
| list | the list on which to prepend |
| element | the element to prepend |
If element is part of a list then that list will be corrupted.
| int slist_remove | ( | struct slist * | list, |
| struct slist_element * | element | ||
| ) |
removes an element from a list
| list | the list from which to remove |
| element | the element to remove |
If element is a member of a list other than list then the other list will be corrupted. The runtime of this function is linear in the length of list.
| int slist_remove_head | ( | struct slist * | list, |
| struct slist_element ** | element | ||
| ) |
removes the first element from a list
| list | the list from which to remove | |
| [out] | element | location where the removed element should be stored |
1.8.14