src/stdlib/table.c
/*=================================================
 * destroy_table -- destroy all element & memory for table
 *===============================================*/
- destroy all element & memory for table
- destroy all element & memory for table
void
destroy_table (TABLE tab)
{
	if (!tab) return;
	ASSERT(tab->vtable == &vtable_for_table);
	ASSERT(tab->refcnt==1 || tab->refcnt==0);
	if (tab->rbtree)
		RbTreeDestroy(tab->rbtree);
	else
		destroy_hashtab(tab->hashtab, tab->destroyfunc);
	memset(tab, 0, sizeof(*tab));
	stdfree(tab);
}
void destroy_table ( TABLE tab ) { if ( ! tab ) return ; ASSERT ( tab -> vtable == & vtable_for_table ) ; ASSERT ( tab -> refcnt == 1 || tab -> refcnt == 0 ) ; if ( tab -> rbtree ) RbTreeDestroy ( tab -> rbtree ) ; else destroy_hashtab ( tab -> hashtab , tab -> destroyfunc ) ; memset ( tab , 0 , sizeof ( * tab ) ) ; stdfree ( tab ) ; }
destroy_table -- destroy all element & memory for table
destroy_table -- destroy all element & memory for table
/* should not be called for a shared table */