Previous: dll_utraverse, Up: Doubly Linked Lists
Traverse a doubly linked list either forwards or backwards, processing each node.
#include <linklist/linklist.h>int dll_utraverse_d( DLinkList ull, int (*action)(void *node,void *udata), void *udata, LinkTraverseDirection direction, void *ndata );
DLinkList 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
LinkTraverseDirection direction
- the direction in which to traverse the list
Possible values for aLinkTraverseDirection
are as follows:HEAD_TO_TAIL
,TAIL_TO_HEAD
void *ndata
- a pointer to a
void *
variable which will recieve the data pointer of the node which caused the traversal to be aborted. The type really isvoid **
.
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, the current node's data pointer is stored in the location
specified by the ndata
argument, and the action routine's
return value is returned.
Compare this to dll_traverse, dll_traverse_d, and dll_utraverse.
If the action routines all return ‘0’, it returns ‘0’, else it returns the value returned by the last action routine called.