src/imap/imap.c
/*
 * Recursive function, call-back function will be called on each item.
 *
 * Walking stops either when the call-back is called on each value or
 * when 'n' is zero. 'n' will be decremented by the result of each call-back.
 */
Recursive function, call-back function will be called on each item.
Walking stops either when the call-back is called on each value or
when 'n' is zero. 'n' will be decremented by the result of each call-back.
Recursive function call - back function will be called on each item . Walking stops either when the call - back is called on each value or when ' n ' is zero . ' n ' will be decremented by the result of each call - back .
void imap_walkn(imap_t * imap, size_t * n, imap_cb cb, void * data)
{
    if (imap->len)
    {
        imap_node_t * nd;
        for (uint_fast8_t i = 0; *n && i < IMAP_NODE_SZ; i++)
        {
            nd = imap->nodes + i;
            if (nd->data != NULL && !(*n -= (*cb)(nd->data, data)))
            {
                return;
            }
            if (nd->nodes != NULL)
            {
                IMAP_walkn(nd, cb, data, n);
            }
        }
    }
}
void imap_walkn ( imap_t * imap , size_t * n , imap_cb cb , void * data ) { if ( imap -> len ) { imap_node_t * nd ; for ( uint_fast8_t i = 0 ; * n && i < IMAP_NODE_SZ ; i ++ ) { nd = imap -> nodes + i ; if ( nd -> data != NULL && ! ( * n -= ( * cb ) ( nd -> data , data ) ) ) { return ; } if ( nd -> nodes != NULL ) { IMAP_walkn ( nd , cb , data , n ) ; } } } }
Recursive function, call-back function will be called on each item.
Recursive function call - back function will be called on each item .