src/stdlib/table.c
/*==========================================
 * delete_table_element -- Delete element from table
 *  tab: [I/O]  table from which to remove element
 *  key: [IN]   key to find element to remove
 * Destroys key and value as appropriate
 *========================================*/
- Delete element from table
tab: [I/O]  table from which to remove element
key: [IN]   key to find element to remove
Destroys key and value as appropriate
- Delete element from table tab : [ I / O ] table from which to remove element key : [ IN ] key to find element to remove Destroys key and value as appropriate
void
delete_table_element (TABLE tab, CNSTRING key)
{
	void * oldval=0;
	ASSERT(tab);
	ASSERT(tab->vtable == &vtable_for_table);
	if (tab->rbtree) {
		RBNODE old = RbExactQuery(tab->rbtree, key);
		if (old)
			RbDeleteNode(tab->rbtree, old);
	} else {
		oldval = remove_hashtab(tab->hashtab, key);
		if (oldval && tab->destroyfunc) {
			(*tab->destroyfunc)(oldval);
		}
	}
}
void delete_table_element ( TABLE tab , CNSTRING key ) { void * oldval = 0 ; ASSERT ( tab ) ; ASSERT ( tab -> vtable == & vtable_for_table ) ; if ( tab -> rbtree ) { RBNODE old = RbExactQuery ( tab -> rbtree , key ) ; if ( old ) RbDeleteNode ( tab -> rbtree , old ) ; } else { oldval = remove_hashtab ( tab -> hashtab , key ) ; if ( oldval && tab -> destroyfunc ) { ( * tab -> destroyfunc ) ( oldval ) ; } } }
delete_table_element -- Delete element from table
  tab: [I/O]  table from which to remove element
  key: [IN]   key to find element to remove
 Destroys key and value as appropriate
delete_table_element -- Delete element from table tab : [ I / O ] table from which to remove element key : [ IN ] key to find element to remove Destroys key and value as appropriate