ucif/antlr3/src/antlr3collections.c
static void
freeIntNode(pANTLR3_INT_TRIE_NODE node)
{
    pANTLR3_TRIE_ENTRY  thisEntry;
    pANTLR3_TRIE_ENTRY  nextEntry;

    /* If this node has a left pointer that is not a back pointer
     * then recursively call to free this
     */
    if (node->bitNum > node->leftN->bitNum)
    {
        /* We have a left node that needs descending, so do it.
         */
        freeIntNode(node->leftN);
    }

    /* The left nodes from here should now be dealt with, so
     * we need to descend any right nodes that are not back pointers
     */
    if (node->bitNum > node->rightN->bitNum)
    {
        /* There are some right nodes to descend and deal with.
         */
        freeIntNode(node->rightN);
    }

    /* Now all the children are dealt with, we can destroy
     * this node too
     */
    thisEntry   = node->buckets;

    while (thisEntry != NULL)
    {
        nextEntry   = thisEntry->next;

        /* Do we need to call a custom free pointer for this string entry?
         */
        if (thisEntry->type == ANTLR3_HASH_TYPE_STR && thisEntry->freeptr != NULL)
        {
            thisEntry->freeptr(thisEntry->data.ptr);
        }

        /* Now free the data for this bucket entry
         */
        ANTLR3_FREE(thisEntry);
        thisEntry = nextEntry;      /* See if there are any more to free    */
    }

    /* The bucket entry is now gone, so we can free the memory for
     * the entry itself.
     */
    ANTLR3_FREE(node);

    /* And that should be it for everything under this node and itself
     */
}
/** Release memory allocated to this tree.
 *  Basic algorithm is that we do a depth first left descent and free
 *  up any nodes that are not backward pointers.
 */
Release memory allocated to this tree.
Basic algorithm is that we do a depth first left descent and free
up any nodes that are not backward pointers.
Release memory allocated to this tree . Basic algorithm is that we do a depth first left descent and free up any nodes that are not backward pointers .
static void
freeIntNode(pANTLR3_INT_TRIE_NODE node)
{
    pANTLR3_TRIE_ENTRY  thisEntry;
    pANTLR3_TRIE_ENTRY  nextEntry;
    if (node->bitNum > node->leftN->bitNum)
    {
        freeIntNode(node->leftN);
    }
    if (node->bitNum > node->rightN->bitNum)
    {
        freeIntNode(node->rightN);
    }
    thisEntry   = node->buckets;
    while (thisEntry != NULL)
    {
        nextEntry   = thisEntry->next;
        if (thisEntry->type == ANTLR3_HASH_TYPE_STR && thisEntry->freeptr != NULL)
        {
            thisEntry->freeptr(thisEntry->data.ptr);
        }
        ANTLR3_FREE(thisEntry);
        thisEntry = nextEntry;      
    }
    ANTLR3_FREE(node);
}
static void freeIntNode ( pANTLR3_INT_TRIE_NODE node ) { pANTLR3_TRIE_ENTRY thisEntry ; pANTLR3_TRIE_ENTRY nextEntry ; if ( node -> bitNum > node -> leftN -> bitNum ) { freeIntNode ( node -> leftN ) ; } if ( node -> bitNum > node -> rightN -> bitNum ) { freeIntNode ( node -> rightN ) ; } thisEntry = node -> buckets ; while ( thisEntry != NULL ) { nextEntry = thisEntry -> next ; if ( thisEntry -> type == ANTLR3_HASH_TYPE_STR && thisEntry -> freeptr != NULL ) { thisEntry -> freeptr ( thisEntry -> data . ptr ) ; } ANTLR3_FREE ( thisEntry ) ; thisEntry = nextEntry ; } ANTLR3_FREE ( node ) ; }
Release memory allocated to this tree.
Release memory allocated to this tree .
/* If this node has a left pointer that is not a back pointer
     * then recursively call to free this
     */ /* We have a left node that needs descending, so do it.
         */ /* The left nodes from here should now be dealt with, so
     * we need to descend any right nodes that are not back pointers
     */ /* There are some right nodes to descend and deal with.
         */ /* Now all the children are dealt with, we can destroy
     * this node too
     */ /* Do we need to call a custom free pointer for this string entry?
         */ /* Now free the data for this bucket entry
         */ /* See if there are any more to free    */ /* The bucket entry is now gone, so we can free the memory for
     * the entry itself.
     */ /* And that should be it for everything under this node and itself
     */