src/imap/imap.c
/*
 * Returns data by a given id, or NULL when not found.
 */
Returns data by a given id, or NULL when not found.
Returns data by a given id or NULL when not found .
void * imap_get(imap_t * imap, uint64_t id)
{
    imap_node_t * nd = imap->nodes + (id % IMAP_NODE_SZ);
    while (1)
    {
        id /= IMAP_NODE_SZ;
        if (!id) return nd->data;
        if (!nd->nodes) return NULL;
        nd = nd->nodes + (--id % IMAP_NODE_SZ);
    }
}
void * imap_get ( imap_t * imap , uint64_t id ) { imap_node_t * nd = imap -> nodes + ( id % IMAP_NODE_SZ ) ; while ( 1 ) { id /= IMAP_NODE_SZ ; if ( ! id ) return nd -> data ; if ( ! nd -> nodes ) return NULL ; nd = nd -> nodes + ( -- id % IMAP_NODE_SZ ) ; } }
Returns data by a given id, or NULL when not found.
Returns data by a given id or NULL when not found .