abc/src/bdd/cudd/cuddLCache.c
/**Function********************************************************************

  Synopsis [Clears the dead entries of the local caches of a manager.]

  Description [Clears the dead entries of the local caches of a manager.
  Used during garbage collection.]

  SideEffects [None]

  SeeAlso     []

******************************************************************************/
Function
Synopsis [Clears the dead entries of the local caches of a manager.]

Description [Clears the dead entries of the local caches of a manager.
Used during garbage collection.]




Function Synopsis [ Clears the dead entries of the local caches of a manager . ] Description [ Clears the dead entries of the local caches of a manager . Used during garbage collection . ]
void
cuddLocalCacheClearDead(
  DdManager * manager)
{
    DdLocalCache *cache = manager->localCaches;
    unsigned int keysize;
    unsigned int itemsize;
    unsigned int slots;
    DdLocalCacheItem *item;
    DdNodePtr *key;
    unsigned int i, j;
    while (cache != NULL) {
        keysize = cache->keysize;
        itemsize = cache->itemsize;
        slots = cache->slots;
        item = cache->item;
        for (i = 0; i < slots; i++) {
            if (item->value != NULL) {
                if (Cudd_Regular(item->value)->ref == 0) {
                    item->value = NULL;
                } else {
                    key = item->key;
                    for (j = 0; j < keysize; j++) {
                        if (Cudd_Regular(key[j])->ref == 0) {
                            item->value = NULL;
                            break;
                        }
                    }
                }
            }
            item = (DdLocalCacheItem *) ((char *) item + itemsize);
        }
        cache = cache->next;
    }
    return;
}
void cuddLocalCacheClearDead ( DdManager * manager ) { DdLocalCache * cache = manager -> localCaches ; unsigned int keysize ; unsigned int itemsize ; unsigned int slots ; DdLocalCacheItem * item ; DdNodePtr * key ; unsigned int i , j ; while ( cache != NULL ) { keysize = cache -> keysize ; itemsize = cache -> itemsize ; slots = cache -> slots ; item = cache -> item ; for ( i = 0 ; i < slots ; i ++ ) { if ( item -> value != NULL ) { if ( Cudd_Regular ( item -> value ) -> ref == 0 ) { item -> value = NULL ; } else { key = item -> key ; for ( j = 0 ; j < keysize ; j ++ ) { if ( Cudd_Regular ( key [ j ] ) -> ref == 0 ) { item -> value = NULL ; break ; } } } } item = ( DdLocalCacheItem * ) ( ( char * ) item + itemsize ) ; } cache = cache -> next ; } return ; }
Function
Synopsis [Clears the dead entries of the local caches of a manager.]
Function Synopsis [ Clears the dead entries of the local caches of a manager . ]