예제 #1
0
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);
    }
}
예제 #2
0
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);
}
예제 #3
0
void HTBTreeAndObject_free( HTBTree *tree )
{
  HTBTElementAndObject_free( (HTBTElement*)&tree->top );
  if ( tree )
  {
    free( tree );
    tree = 0;
  }
  return;
}
예제 #4
0
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;
}