22#include "px_link_list.h"
38 size_t max_nr_of_items)
129 list->
first->prev = item;
158 list->
last->next = item;
186 if(list->
first == item_pos)
191 item->
next = item_pos;
192 item_pos->
prev = item;
198 item->
next = item_pos;
199 item_pos->
prev->next = item;
200 item_pos->
prev = item;
228 if(list->
last == item_pos)
232 item->
prev = item_pos;
234 item_pos->
next = item;
239 item->
prev = item_pos;
241 item_pos->
next->prev = item;
242 item_pos->
next = item;
320 if(item == list->
first)
327 if(item == list->
last)
349 while(item_in_list !=
NULL)
351 if(item_in_list == item)
357 item_in_list = item_in_list->
next;
#define NULL
NULL pointer.
struct px_link_list_item_s * next
Pointer to next item in the list.
size_t item_count
Number of items in the list.
size_t items_max
Maximum number of items allowed in list; 0 means no limit.
struct px_link_list_item_s * first
Pointer to first item in the list.
struct px_link_list_item_s * last
Pointer to last item in the list.
struct px_link_list_item_s * prev
Pointer to previous item in the list.
bool px_link_list_is_empty(px_link_list_t *list)
See if the list is empty.
px_link_list_item_t * px_link_list_get_item_next(px_link_list_t *list, px_link_list_item_t *item)
Get a pointer to the next item in the list (after the specified item).
size_t px_link_list_get_item_count(px_link_list_t *list)
Get the number of items in the list.
px_link_list_item_t * px_link_list_remove_item_last(px_link_list_t *list)
Remove last item from the list.
bool px_link_list_insert_item_end(px_link_list_t *list, px_link_list_item_t *item)
Add item to the end of the list.
px_link_list_item_t * px_link_list_get_item_last(px_link_list_t *list)
Get a pointer to the last item in the list.
px_link_list_item_t * px_link_list_get_item_first(px_link_list_t *list)
Get a pointer to the first item in the list.
px_link_list_item_t * px_link_list_remove_item_first(px_link_list_t *list)
Remove first item from the list.
px_link_list_item_t * px_link_list_get_item_prev(px_link_list_t *list, px_link_list_item_t *item)
Get a pointer to the previous item in the list (before the specified item).
bool px_link_list_has_item(px_link_list_t *list, px_link_list_item_t *item)
See if item is in the list.
void px_link_list_init(px_link_list_t *list, size_t max_nr_of_items)
Initialises a linked list structure.
void px_link_list_remove_item(px_link_list_t *list, px_link_list_item_t *item)
Remove item from the list.
bool px_link_list_insert_item_after(px_link_list_t *list, px_link_list_item_t *item, px_link_list_item_t *item_pos)
Insert item after specified item.
bool px_link_list_is_full(px_link_list_t *list)
See if the list is full.
void px_link_list_item_init(px_link_list_t *list, px_link_list_item_t *item)
Initialises a list item.
bool px_link_list_insert_item_start(px_link_list_t *list, px_link_list_item_t *item)
Insert item to the start of the list.
bool px_link_list_insert_item_before(px_link_list_t *list, px_link_list_item_t *item, px_link_list_item_t *item_pos)
Insert item before specified item.
Link structure that must be at the head of each item in the list.