示例#1
0
/**
    @brief Delete node and ALL of subnodes

    @param node_p Pointer to deletable node
    @param dump_file File that may contain debug info
    @return 0 always
*/
int Node_delete(Node_t* node_p, FILE* dump_file)
{
    assert(dump_file);
    VALID_NODE(node_p, "Invalid node in the beginning of Node_delete", dump_file);

    Node_dtor(node_p, dump_file);

    return 0;
}
示例#2
0
/**
    @brief Destructs node and ALL of subnodes

    @param node_p Pointer to node
    @param dump_file File that may contain debug info
    @return 0 always
*/
int Node_dtor(Node_t* node_p, FILE* dump_file)
{
    assert(dump_file);
    VALID_NODE(node_p, "Invalid node in the beginning of Node_dtor", dump_file);

    free(node_p->data);
    node_p->data = NULL;

    if (node_p->lft)
    {
        Node_dtor(node_p->lft, dump_file);
        node_p->lft = NULL;
    }
    if (node_p->rgt)
    {
        Node_dtor(node_p->rgt, dump_file);
        node_p->rgt = NULL;
    }
    free(node_p);

    return 0;
}
示例#3
0
/*
 * ***************************************************************************
 * Routine:  Bnode_dtor
 *
 * Purpose:  The Block node destructor.
 *
 * Author:   Michael Holst
 * ***************************************************************************
 */
VPUBLIC void Bnode_dtor(Bnode **thee)
{
    int i;

    /* VASSERT( (*thee) != VNULL ); */
    if ((*thee) != VNULL) {

        for (i=0; i<(*thee)->numB; i++) {
            Node_dtor( (&(*thee)->ND[i]) );
        }

        VDEBUGIO("Bnode_dtor: DESTROYING object..");
        if ((*thee)->iMadeVmem) Vmem_dtor( &((*thee)->vmem) );
        Vmem_free( VNULL, 1, sizeof(Bnode), (void**)thee );
        VDEBUGIO("..done.\n"); 

        (*thee) = VNULL;
    }
}