This provides a thread-safe implementation of a linked list which can be used with any data type.
◆ MMAL_LIST_COMPARE_T
List comparison function. This is supplied by a client when inserting an element in the middle of the list. The list will always insert a smaller element in front of a larger element.
- Returns
- TRUE: lhs < rhs FALSE: lhs >= rhs
Definition at line 108 of file mmal_list.h.
◆ MMAL_LIST_ELEMENT_T
Single element in the list
◆ MMAL_LIST_T
Linked list type. Clients shouldn't modify this directly. Use the provided API functions to add new elements. The public members are only for debug purposes.
◆ mmal_list_create()
Create a new linked list.
- Returns
- Pointer to new queue (NULL on failure).
◆ mmal_list_destroy()
Destroy a linked list.
- Parameters
-
◆ mmal_list_insert()
Insert an element into the list. The location where the element is inserted is determined using the supplied comparison function. Smaller elements are inserted in front of larger elements.
- Parameters
-
list | List to add to |
element | The element to insert |
compare | Comparison function supplied by the client |
◆ mmal_list_pop_back()
Remove the last element in the list.
- Parameters
-
- Returns
- Pointer to the last element (or NULL if empty)
◆ mmal_list_pop_front()
Remove the first element in the list.
- Parameters
-
- Returns
- Pointer to the first element (or NULL if empty)
◆ mmal_list_push_back()
Add an element to the back of the list.
- Parameters
-
list | List to add to |
element | The element to add |
◆ mmal_list_push_front()
Add an element to the front of the list.
- Parameters
-
list | List to add to |
element | The element to add |