Skip to content

<list.h>

Intrusive circular doubly linked list with a sentinel head.

#include <list.h>

Constants

Name Value Description
LIST_FOR_EACH_SAFE(pos, n, head) Walks a list with n holding the next node, so pos may be removed.
LIST_FOR_EACH(pos, head) Walks a list from head's sentinel; pos must not be removed.
LIST_HEAD_INIT(name) Static initializer for an empty ListHead named name.
container_of(ptr, type, member) Gets the object of type type that embeds ptr as its field member.

Structures

ListNode

A link, embedded in the listed object.

Field Type Description
prev struct ListNodeStruct * Previous node.
next struct ListNodeStruct * Next node.

ListHead

A list: the sentinel node, which points to itself when the list is empty.

Field Type Description
node ListNode The sentinel.