list.h File Reference

Intrusive linked list. More...

Detailed Description

Intrusive linked list.

Lists are represented as element pointing to the first actual list element.

Author
Kaspar Schleiser kaspa.nosp@m.r@sc.nosp@m.hleis.nosp@m.er.d.nosp@m.e
Víctor Ariño victo.nosp@m.r.ar.nosp@m.ino@z.nosp@m.ii.a.nosp@m.ero

Definition in file list.h.

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  list_node
 List node structure. More...
 
typedef struct list_node list_node_t
 List node structure. More...
 
static void list_add (list_node_t *node, list_node_t *new_node)
 Insert object into list. More...
 
static list_node_tlist_remove_head (list_node_t *list)
 Removes the head of the list and returns it. More...
 
static list_node_tlist_remove (list_node_t *list, list_node_t *node)
 Removes the node from the list. More...
 

Typedef Documentation

◆ list_node_t

typedef struct list_node list_node_t

List node structure.

Used as is as reference to a list, or as member of any data structure that should be member of a list.

Actual list objects should have a list_node_t as member and then use the container_of() macro in list operations. See thread_add_to_list() as example.

Function Documentation

◆ list_add()

static void list_add ( list_node_t node,
list_node_t new_node 
)
inlinestatic

Insert object into list.

If called with a list reference as node, the new node will become the new list head.

Parameters
[in]nodelist node before new entry
[in]new_nodelist node to insert

Definition at line 53 of file list.h.

◆ list_remove()

static list_node_t* list_remove ( list_node_t list,
list_node_t node 
)
inlinestatic

Removes the node from the list.

Parameters
[in]listPointer to the list itself, where list->next points to the root node
[in]nodeList node to remove from the list
Returns
removed node, or NULL if empty or not found

Definition at line 86 of file list.h.

◆ list_remove_head()

static list_node_t* list_remove_head ( list_node_t list)
inlinestatic

Removes the head of the list and returns it.

Parameters
[in]listPointer to the list itself, where list->next points to the root node
Returns
removed old list head, or NULL if empty

Definition at line 67 of file list.h.