static void hash_free_node(RFG_RegionInfo* htab)
{
  if( htab->next )
    hash_free_node( htab->next );   /* call recursive */

  free( htab->groupName );
  free( htab->regionName );
  free( htab );
}
static void hash_free(RFG_RegionInfo** htab)
{
  uint32_t i;
  
  /* free hash nodes */

  for( i = 0; i < HASH_MAX; i++ )
  {
    if( htab[i] )
      hash_free_node( htab[i] );
  }
}
Beispiel #3
0
static void hash_release(void* hash_table, int is_destroy, void* pool_handle)
{
    hash_t* hash = (hash_t*) hash_table;
    int i = 0;
    for (i = 0; i < hash->max_buckets; i++) {
        bucket_t* bucket = &(hash->bucket_list[i]);
        node_t *bucket_node;
        if (bucket->list != NULL) {
            while (NULL != (bucket_node = list_pop_front(bucket->list))) {
                hash_free_node(bucket_node, pool_handle);
            }
            (void) pool_free_element(pool_handle, POOL_TYPE_LIST_T, bucket->list);
            bucket->list = NULL;
            bucket->list_count = 0;
        }
    }
    if (is_destroy) {
        pool_free_element(pool_handle, POOL_TYPE_BUCKET_T, hash->bucket_list);
        pool_free_element(pool_handle, POOL_TYPE_HASH_T, hash);
    } else {
        hash->entry_count = 0;
    }
}