void TOutlineViewer::disposeNode(TNode *node) {
   if (node) {
      if (node->childList)
         disposeNode(node->childList);
      if (node->next)
         disposeNode(node->next);
      delete node;
   }
}
Beispiel #2
0
 void DictImpl::disposeBits( bits_t *bits ) const
 {
   node_t *node = bits->firstNode;
   while ( node )
   {
     node_t *nextNode = node->bitsNextNode;
     disposeNode( node );
     node = nextNode;
   }
   free( bits->buckets );
 }
Beispiel #3
0
 void DictImpl::removeNode( bits_t *bits, bucket_t *bucket, node_t *node ) const
 {
   if ( node->bitsPrevNode )
   {
     FABRIC_ASSERT( node->bitsPrevNode->bitsNextNode == node );
     node->bitsPrevNode->bitsNextNode = node->bitsNextNode;
   }
   else
   {
     FABRIC_ASSERT( bits->firstNode == node );
     bits->firstNode = node->bitsNextNode;
   }
   
   if ( node->bitsNextNode )
   {
     FABRIC_ASSERT( node->bitsNextNode->bitsPrevNode == node );
     node->bitsNextNode->bitsPrevNode = node->bitsPrevNode;
   }
   else
   {
     FABRIC_ASSERT( bits->lastNode == node );
     bits->lastNode = node->bitsPrevNode;
   }
   
   if ( node->bucketPrevNode )
   {
     FABRIC_ASSERT( node->bucketPrevNode->bucketNextNode == node );
     node->bucketPrevNode->bucketNextNode = node->bucketNextNode;
   }
   else
   {
     FABRIC_ASSERT( bucket->firstNode == node );
     bucket->firstNode = node->bucketNextNode;
   }
   
   if ( node->bucketNextNode )
   {
     FABRIC_ASSERT( node->bucketNextNode->bucketPrevNode == node );
     node->bucketNextNode->bucketPrevNode = node->bucketPrevNode;
   }
   else
   {
     FABRIC_ASSERT( bucket->lastNode == node );
     bucket->lastNode = node->bucketPrevNode;
   }
   
   --bits->nodeCount;
   disposeNode( node );
 }
Beispiel #4
0
 void DictImpl::clear( void *data ) const
 {
   bits_t *bits = *reinterpret_cast<bits_t **>( data );
   if ( bits )
   {
     node_t *node = bits->firstNode;
     while ( node )
     {
       node_t *nextNode = node->bitsNextNode;
       disposeNode( node );
       node = nextNode;
     }
     bits->nodeCount = 0;
     bits->firstNode = bits->lastNode = 0;
     for ( size_t i=0; i<bits->bucketCount; ++i )
     {
       bucket_t *bucket = &bits->buckets[i];
       bucket->firstNode = bucket->lastNode = 0;
     }
   }
 }
Beispiel #5
0
static void disposeNode (Node n, int boardSize) {

    if (n != NULL) {
    
        int i;
        
        if (n->endPoint == NULL) {
            for (i = 0; i < boardSize; i++) {
        
                disposeNode (n->next[i], boardSize);
            }
        }
        
        free (n->next);
        
        if (n->endPoint != NULL) {
        
            disposeState (n->endPoint);
        }
        
        free (n);
    }
}
Beispiel #6
0
void disposePTree (PTree p) {

    disposeNode (p->root, p->boardSize);
    free (p);
}
TOutline::~TOutline() {
   disposeNode(root);
}