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


3.1.34 sll_utraverse

Traverse a singly linked list, processing each node.

Synopsis

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

Parameters

SLinkList ull
A handle to the list to traverse
int (*action)(void *node,void *udata)
The user supplied action routine applied to each node
void *udata
a pointer to data to be passed to the action routine

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 as well as a pointer provided by the calling routine, thus allowing arbitrary data to be available to the action routine. 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, sll_traverse_d, 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.