Lite list implementation from Linux kernel.
More...
|
#define | list_initializer(list) { .prev = list, .next = list, } |
| should be used to static initialization More...
|
|
#define | list_init(list) |
| should be used to runtime initialization More...
|
|
#define | containerof(ptr, type, field) ((type*)((size_t)(ptr) - offsetof(type, field))) |
| return pointer to struct of type, which hold field More...
|
|
#define | list_foreach(list, node, type, field) |
| iterate over all list nodes More...
|
|
#define | list_foreach_safe(l, i, t, type, f) |
| iterate over all list nodes, also allow node deletion More...
|
|
#define | list_add_head(list, node) |
| add node to head of list More...
|
|
#define | list_add_tail(list, node) |
| add node to tail of list More...
|
|
#define | list_del_node(node) |
| remove node from list More...
|
|
#define | list_is_empty(list) ((list)->prev == (list) && (list) == (list)->next) |
| expression is true, if list is empty More...
|
|
Lite list implementation from Linux kernel.
#define containerof |
( |
|
ptr, |
|
|
|
type, |
|
|
|
field |
|
) |
| ((type*)((size_t)(ptr) - offsetof(type, field))) |
return pointer to struct of type, which hold field
#define list_add_head |
( |
|
list, |
|
|
|
node |
|
) |
| |
Value:do { \
(node)->next = (
list)->next; \
(
list)->next->prev = (node); \
} while(0); \
node of double-linked list
Definition: list.h:35
add node to head of list
#define list_add_tail |
( |
|
list, |
|
|
|
node |
|
) |
| |
Value:do { \
(node)->prev = (
list)->prev; \
(
list)->prev->next = (node); \
} while(0); \
node of double-linked list
Definition: list.h:35
add node to tail of list
#define list_del_node |
( |
|
node | ) |
|
Value:do { \
(node)->next->prev = (node)->prev; \
(node)->prev->next = (node)->next; \
(node)->prev = (node)->next = NULL; \
} while(0);
remove node from list
#define list_foreach |
( |
|
list, |
|
|
|
node, |
|
|
|
type, |
|
|
|
field |
|
) |
| |
Value: &(node)->field != (
list); \
#define containerof(ptr, type, field)
return pointer to struct of type, which hold field
Definition: list.h:59
node of double-linked list
Definition: list.h:35
iterate over all list nodes
#define list_foreach_safe |
( |
|
l, |
|
|
|
i, |
|
|
|
t, |
|
|
|
type, |
|
|
|
f |
|
) |
| |
Value:for ( \
&(i)->f != (l); \
)
#define containerof(ptr, type, field)
return pointer to struct of type, which hold field
Definition: list.h:59
iterate over all list nodes, also allow node deletion
- Parameters
-
[in] | l | pointer to struct list |
[out] | i | iterator of list |
[out] | t | temporary pointer for safe list manipulation |
[in] | type | type of list |
[in] | f | name of struct list field in type |
#define list_init |
( |
|
list | ) |
|
Value:do { \
} while (0)
node of double-linked list
Definition: list.h:35
should be used to runtime initialization
#define list_initializer |
( |
|
list | ) |
{ .prev = list, .next = list, } |
should be used to static initialization
expression is true, if list is empty