Example #1
0
/*
*     Recursively walk and free nodes
*/
static void KMapFreeNode( KMAP * km, KMAPNODE * r)
{
    if( r->sibling )
    {
        KMapFreeNode( km, r->sibling );
    }

    if( r->child )
    {
        KMapFreeNode( km, r->child );
    }

    s_free( r );
}
/*
*  Free the KMAP and all of it's memory and nodes
*/
void KMapDelete( KMAP * km )
{
    KMAPNODE * r;
    int        i;
    
    /* Free the tree - on root node at a time */
    for(i=0;i<256;i++)
    {
        r = km->root[i];
        if( r )
        { 
            KMapFreeNode(km,r); 
        }
    }
    
    /* Free the node list */
    KMapFreeNodeList( km );
    
    s_free(km);
}