PRIVATE void HTBTElement_free (HTBTElement* element) /********************************************************** ** This void will HT_FREE the memory allocated for one element */ { if (element) { if (element->left != NULL) HTBTElement_free(element->left); if (element->right != NULL) HTBTElement_free(element->right); HT_FREE(element); } }
PUBLIC void HTBTree_free (HTBTree* tree) /************************************************************** ** This void will HT_FREE the memory allocated for the whole tree */ { HTBTElement_free(tree->top); HT_FREE(tree); }
void HTBTElement_free( HTBTElement *element ) { if ( element ) { if ( element->left ) HTBTElement_free( &element->left ); if ( element->right ) HTBTElement_free( &element->right ); if ( element == 0 ) { return; } free( element ); element = 0; } return; }
void HTBTree_free( HTBTree *tree ) { HTBTElement_free( (HTBTElement*)&tree->top ); if ( tree ) { free( tree ); tree = 0; } return; }