20#ifndef ZEPHYR_INCLUDE_SYS_SLIST_H_
21#define ZEPHYR_INCLUDE_SYS_SLIST_H_
66#define SYS_SLIST_FOR_EACH_NODE(__sl, __sn) \
67 Z_GENLIST_FOR_EACH_NODE(slist, __sl, __sn)
89#define SYS_SLIST_ITERATE_FROM_NODE(__sl, __sn) \
90 Z_GENLIST_ITERATE_FROM_NODE(slist, __sl, __sn)
108#define SYS_SLIST_FOR_EACH_NODE_SAFE(__sl, __sn, __sns) \
109 Z_GENLIST_FOR_EACH_NODE_SAFE(slist, __sl, __sn, __sns)
119#define SYS_SLIST_CONTAINER(__ln, __cn, __n) \
120 Z_GENLIST_CONTAINER(__ln, __cn, __n)
129#define SYS_SLIST_PEEK_HEAD_CONTAINER(__sl, __cn, __n) \
130 Z_GENLIST_PEEK_HEAD_CONTAINER(slist, __sl, __cn, __n)
139#define SYS_SLIST_PEEK_TAIL_CONTAINER(__sl, __cn, __n) \
140 Z_GENLIST_PEEK_TAIL_CONTAINER(slist, __sl, __cn, __n)
148#define SYS_SLIST_PEEK_NEXT_CONTAINER(__cn, __n) \
149 Z_GENLIST_PEEK_NEXT_CONTAINER(slist, __cn, __n)
165#define SYS_SLIST_FOR_EACH_CONTAINER(__sl, __cn, __n) \
166 Z_GENLIST_FOR_EACH_CONTAINER(slist, __sl, __cn, __n)
183#define SYS_SLIST_FOR_EACH_CONTAINER_SAFE(__sl, __cn, __cns, __n) \
184 Z_GENLIST_FOR_EACH_CONTAINER_SAFE(slist, __sl, __cn, __cns, __n)
209#define SYS_SLIST_STATIC_INIT(ptr_to_list) {NULL, NULL}
218 parent->next = child;
268Z_GENLIST_IS_EMPTY(slist)
281Z_GENLIST_PEEK_NEXT_NO_CHECK(slist, snode)
292Z_GENLIST_PEEK_NEXT(slist, snode)
305Z_GENLIST_PREPEND(slist, snode)
318Z_GENLIST_APPEND(slist, snode)
334 void *head,
void *tail);
336Z_GENLIST_APPEND_LIST(slist, snode)
350Z_GENLIST_MERGE_LIST(slist, snode)
365Z_GENLIST_INSERT(slist, snode)
379Z_GENLIST_GET_NOT_EMPTY(slist, snode)
392Z_GENLIST_GET(slist, snode)
408Z_GENLIST_REMOVE(slist, snode)
436Z_GENLIST_FIND(slist, snode)
447Z_GENLIST_LEN(slist, snode)
450Z_GENLIST_FIND_AND_REMOVE(slist, snode)
static size_t sys_slist_len(sys_slist_t *list)
Compute the size of the given list in O(n) time.
Definition: slist.h:447
static sys_snode_t * sys_slist_get_not_empty(sys_slist_t *list)
Fetch and remove the first node of the given list.
Definition: slist.h:379
static void sys_slist_merge_slist(sys_slist_t *list, sys_slist_t *list_to_append)
merge two slists, appending the second one to the first
Definition: slist.h:350
static sys_snode_t * sys_slist_peek_head(sys_slist_t *list)
Peek the first node from the list.
Definition: slist.h:238
static bool sys_slist_find_and_remove(sys_slist_t *list, sys_snode_t *node)
Find and remove a node from a list.
Definition: slist.h:450
struct _slist sys_slist_t
Single-linked list structure.
Definition: slist.h:49
static sys_snode_t * sys_slist_get(sys_slist_t *list)
Fetch and remove the first node of the given list.
Definition: slist.h:392
static sys_snode_t * sys_slist_peek_tail(sys_slist_t *list)
Peek the last node from the list.
Definition: slist.h:250
static sys_snode_t * sys_slist_peek_next_no_check(sys_snode_t *node)
Peek the next node from current node, node is not NULL.
Definition: slist.h:281
struct _snode sys_snode_t
Single-linked list node structure.
Definition: slist.h:39
static sys_snode_t * sys_slist_peek_next(sys_snode_t *node)
Peek the next node from current node.
Definition: slist.h:292
static bool sys_slist_is_empty(sys_slist_t *list)
Test if the given list is empty.
Definition: slist.h:268
static void sys_slist_append(sys_slist_t *list, sys_snode_t *node)
Append a node to the given list.
Definition: slist.h:318
static void sys_slist_init(sys_slist_t *list)
Initialize a list.
Definition: slist.h:199
static void sys_slist_append_list(sys_slist_t *list, void *head, void *tail)
Append a list to the given list.
Definition: slist.h:336
static void sys_slist_prepend(sys_slist_t *list, sys_snode_t *node)
Prepend a node to the given list.
Definition: slist.h:305
static bool sys_slist_find(sys_slist_t *list, sys_snode_t *node, sys_snode_t **prev)
Find if a node is already linked in a singly linked list.
Definition: slist.h:436
static void sys_slist_insert(sys_slist_t *list, sys_snode_t *prev, sys_snode_t *node)
Insert a node to the given list.
Definition: slist.h:365
static void sys_slist_remove(sys_slist_t *list, sys_snode_t *prev_node, sys_snode_t *node)
Remove a node.
Definition: slist.h:408