src/imap/imap.c
/*
 * Run the call-back function on all items in the map.
 *
 * All the results are added together and are returned as the result of
 * this function.
 */
Run the call-back function on all items in the map.
All the results are added together and are returned as the result of
this function.
Run the call - back function on all items in the map . All the results are added together and are returned as the result of this function .
int imap_walk(imap_t * imap, imap_cb cb, void * data)
{
    int rc = 0;
    if (imap->len)
    {
        imap_node_t * nd;
        for (uint_fast8_t i = 0; i < IMAP_NODE_SZ; i++)
        {
            nd = imap->nodes + i;
            if (nd->data != NULL)
            {
                rc += (*cb)(nd->data, data);
            }
            if (nd->nodes != NULL)
            {
                IMAP_walk(nd, cb, data, &rc);
            }
        }
    }
    return rc;
}
int imap_walk ( imap_t * imap , imap_cb cb , void * data ) { int rc = 0 ; if ( imap -> len ) { imap_node_t * nd ; for ( uint_fast8_t i = 0 ; i < IMAP_NODE_SZ ; i ++ ) { nd = imap -> nodes + i ; if ( nd -> data != NULL ) { rc += ( * cb ) ( nd -> data , data ) ; } if ( nd -> nodes != NULL ) { IMAP_walk ( nd , cb , data , & rc ) ; } } } return rc ; }
Run the call-back function on all items in the map.
Run the call - back function on all items in the map .