FreeRTOS C-Addons  1.1.0
C-Addon functionality to FreeRTOS
Functions
slist.c File Reference
#include <stdlib.h>
#include "slist.h"
Include dependency graph for slist.c:

Go to the source code of this file.

Functions

void SlAddNodeToTail (SlNode_t *Head, SlNode_t *Node)
 
void SlInsertNodeAfter (SlNode_t *Marker, SlNode_t *Node)
 
void SlInsertNodeBefore (SlNode_t *Head, SlNode_t *Marker, SlNode_t *Node)
 
void SlRemoveNode (SlNode_t *Head, SlNode_t *Node)
 
SlNode_t * SlRemoveNodeFromHead (SlNode_t *Head)
 
SlNode_t * SlRemoveNodeFromTail (SlNode_t *Head)
 

Function Documentation

◆ SlAddNodeToTail()

void SlAddNodeToTail ( SlNode_t *  Head,
SlNode_t *  Node 
)

Add a node to the list tail. Runs in O(n) time.

Parameters
HeadA pointer to the existing list head.
NodeA pointer to the node you are adding.

Definition at line 44 of file slist.c.

◆ SlInsertNodeAfter()

void SlInsertNodeAfter ( SlNode_t *  Marker,
SlNode_t *  Node 
)

Inserts a new node into the list right after the marker element. Runs in O(1) time.

Parameters
MarkerThe node you are inserting after. Cannot be NULL.
NodeThe node you are inserting. Cannot be NULL.

Definition at line 68 of file slist.c.

◆ SlInsertNodeBefore()

void SlInsertNodeBefore ( SlNode_t *  Head,
SlNode_t *  Marker,
SlNode_t *  Node 
)

Inserts a new node into the list right before the marker element. Runs in O(n) time.

Parameters
HeadPointer to the list head.
MarkerNode you are inserting before. Cannot be NULL.
NodeThe node you are inserting. Cannot be NULL.

Definition at line 87 of file slist.c.

◆ SlRemoveNode()

void SlRemoveNode ( SlNode_t *  Head,
SlNode_t *  Node 
)

Removes a node from the list. Runs in O(n) time worst case.

Parameters
HeadPointer to the list head.
NodeThe node you are removing.

Definition at line 127 of file slist.c.

◆ SlRemoveNodeFromHead()

SlNode_t* SlRemoveNodeFromHead ( SlNode_t *  Head)

Removes the node from the list head. Runs in O(1) time.

Parameters
HeadA pointer to the existing list head.
Returns
The node removed, or NULL for an empty list.

Definition at line 162 of file slist.c.

◆ SlRemoveNodeFromTail()

SlNode_t* SlRemoveNodeFromTail ( SlNode_t *  Head)

Removes the node from the list tail. Runs in O(n) time.

Parameters
HeadA pointer to the existing list head.
Returns
The node removed, or NULL for an empty list.

Definition at line 181 of file slist.c.