next up previous contents index
Next: 16.8.13 amm_iterate_func: Function to Up: 16.8 API reference Previous: 16.8.11 amm_init_gen: initialize an

16.8.12 amm_iterate: Call a user-defined function for every entry in an AMM (simple interface)

 

SYNOPSIS

#include <oskit/amm.h>

int amm_iterate(amm_t *amm, int (*amm_iterate_func)(), void *arg);

DESCRIPTION

Calls a user-provided function amm_iterate_func for every entry of amm.

Arg is an opaque value which is passed to every instance of amm_iterate_func along with amm and the entry itself.

amm_iterate continues until the function has been called for all entries in the AMM or until one instance of the function returns non-zero. In the latter case, that non-zero value will be returned from amm_iterate.

Since the iteration function may modify or even destroy the entry passed in, amm_iterate uses the following technique for locating the ``next'' entry. At the beginning of each iteration, amm_iterate records the last address covered by the current entry. After the specified iteration function returns, amm_find_addr is called with this address to ``relocate'' the current entry. From this entry, amm_iterate derives the next entry.

PARAMETERS

amm
A pointer to the amm_t structure representing the address map.
amm_iterate_func
Function to be called for every entry.
arg
Argument to be passed to every instance of the iteration function.

RETURNS

Returns zero if amm_iterate_func returned zero for all entries. Returns the first non-zero value returned from any amm_iterate_func call.

RELATED INFORMATION

amm_iterate_func



University of Utah Flux Research Group