library/src/datastructures/BP-HashTable.cc
// Attempts to checkout a registry and seek a table within it.  Within that
// table, it will try to remove the provided entry parameter.
Attempts to checkout a registry and seek a table within it.  Within that
table, it will try to remove the provided entry parameter.
Attempts to checkout a registry and seek a table within it . Within that table it will try to remove the provided entry parameter .
BP_ERROR_T BP_HashRegDestroyEntry
(
	P_BP_HASH_TABLE_REGISTRY    hreg,
	P_BP_HASH_TABLE_KEYED_ENTRY entry_within_table_to_destroy
)
{
	BP_GLOBAL_HASH_TABLE_OVERRIDE(ERR_FAILURE);
	P_BP_HASH_TABLE_KEYED_ENTRY parent_table = (P_BP_HASH_TABLE_KEYED_ENTRY) entry_within_table_to_destroy->parent;
	if(!parent_table)
		return ERR_FAILURE;
	if(BP_HashRegCheckOutTable(hreg, parent_table, BP_TRUE) != ERR_SUCCESS)
	{
		return ERR_FAILURE;
	}
	if(entry_within_table_to_destroy->type == BP_HASH_TABLE_KEYED_ENTRY_TYPE_NAMED_HASH_TABLE)
		return ERR_FAILURE;
	BP_ERROR_T data_destroy_status = BP_HashRegDestroyKeyedEntryData
	(
		hreg,
		entry_within_table_to_destroy
	);
	if(data_destroy_status == ERR_FAILURE)
	{
		return ERR_FAILURE;
	}
	if(BP_HashRegCheckInTable(hreg, parent_table) != ERR_SUCCESS)
	{
		return ERR_FAILURE;
	}
	return ERR_SUCCESS;
}
BP_ERROR_T BP_HashRegDestroyEntry ( P_BP_HASH_TABLE_REGISTRY hreg , P_BP_HASH_TABLE_KEYED_ENTRY entry_within_table_to_destroy ) { BP_GLOBAL_HASH_TABLE_OVERRIDE ( ERR_FAILURE ) ; P_BP_HASH_TABLE_KEYED_ENTRY parent_table = ( P_BP_HASH_TABLE_KEYED_ENTRY ) entry_within_table_to_destroy -> parent ; if ( ! parent_table ) return ERR_FAILURE ; if ( BP_HashRegCheckOutTable ( hreg , parent_table , BP_TRUE ) != ERR_SUCCESS ) { return ERR_FAILURE ; } if ( entry_within_table_to_destroy -> type == BP_HASH_TABLE_KEYED_ENTRY_TYPE_NAMED_HASH_TABLE ) return ERR_FAILURE ; BP_ERROR_T data_destroy_status = BP_HashRegDestroyKeyedEntryData ( hreg , entry_within_table_to_destroy ) ; if ( data_destroy_status == ERR_FAILURE ) { return ERR_FAILURE ; } if ( BP_HashRegCheckInTable ( hreg , parent_table ) != ERR_SUCCESS ) { return ERR_FAILURE ; } return ERR_SUCCESS ; }
Attempts to checkout a registry and seek a table within it.
Attempts to checkout a registry and seek a table within it .
// macro to override hreg on null // create reference to the parent table // esnure we have a parent table to work with // Ensure we can check in the table before continuing.  Since checkouts cascade // check entry type, make sure it's not a table // destroy the keyed entry at this position // exit if the lock failed // printf("\n [!!] Failed to destroy data."); // Ensure we can check in the table before exiting. // return indicating success