Define LLIST_FOREACH

Define Documentation

LLIST_FOREACH(LIST, DIR, VAR)

Iterate over a llist.

To go forward, pass ‘next’ as the DIR field; to iterate through the list backward, pass ‘prev’ in the DIR field.

You cannot use this macro directly if you are manipulating the next/prev fields. You cannot call this macro on a NULL/unitialized list.

Parameters:
  • LIST – The linked list

  • DIR – The name of the field used for traversal (next or prev), which sets the direction of traversal.

  • VAR – The name of the llist_node* local variable to each node will be assigned to when iterating over the list.