Next: , Previous: sll_tail_node, Up: Singly Linked Lists


3.1.32 sll_traverse

Traverse a singly linked list, processing each node.

Synopsis

     #include <linklist/linklist.h>
     
     
     
int sll_traverse( SLinkList ull, int (*action)(void *) );

Parameters

SLinkList ull
A handle to the list to traverse
int (*action)(void *)
The user supplied action routine to be applied to each node

Description

This routine walks along a list, calling a user supplied action function at each node. The action routine is passed the node's data pointer. If an invocation of the action routine returns non-zero, the traversal is aborted and the action routine's return value is returned.

Compare this to sll_traverse_d, sll_utraverse, and sll_utraverse_d.

Returns

If the action routines all return ‘0’, it returns ‘0’, else it returns the value returned by the last action routine called.