PRIVATE void HTBTElementAndObject_free (HTBTElement* element) /********************************************************** ** This void will HT_FREE the memory allocated for one element */ { if (element) { /* Just in case nothing was in the tree anyway */ if (element->left != NULL) HTBTElementAndObject_free(element->left); if (element->right != NULL) HTBTElementAndObject_free(element->right); HT_FREE(element->object); HT_FREE(element); } }
PUBLIC void HTBTreeAndObject_free (HTBTree* tree) /************************************************************** ** This void will HT_FREE the memory allocated for the whole tree */ { HTBTElementAndObject_free(tree->top); HT_FREE(tree); }
void HTBTreeAndObject_free( HTBTree *tree ) { HTBTElementAndObject_free( (HTBTElement*)&tree->top ); if ( tree ) { free( tree ); tree = 0; } return; }
void HTBTElementAndObject_free( HTBTElement *element ) { if ( element ) { if ( element->left ) HTBTElementAndObject_free( &element->left ); if ( element->right ) HTBTElementAndObject_free( &element->right ); if ( element->object[0] ) { free( &element->object[0] ); element->object[0] = 0; } if ( element == 0 ) { return; } free( element ); element = 0; } return; }