library/src/datastructures/BP-HashTable.cc
// Destroys memory allocated in the hash table
Destroys memory allocated in the hash table
Destroys memory allocated in the hash table
BP_ERROR_T ht_free_real
(
		P_BP_HASH_TABLE_REGISTRY hreg,
		void *ptr,
		BPLN_PARMS
)
{
	BP_GLOBAL_HASH_TABLE_OVERRIDE(ERR_FAILURE);
	if(!hreg)
		return ERR_FAILURE;
	if(!ptr)
		return ERR_FAILURE;
	BP_HASH_TABLE_ENTER_CRITICAL_SECTION(hreg);
	P_BP_HASH_TABLE_MEM_PTR_ENTRY lookup_entry = NULL;
	lookup_entry = (P_BP_HASH_TABLE_MEM_PTR_ENTRY) BP_HashRegMemPtrFind(hreg, ptr);
	if(!lookup_entry)
		return ERR_FAILURE;
	BP_ERROR_T delete_status = BP_HashRegDeleteMemoryEntry(hreg, lookup_entry);
	BP_HASH_TABLE_LEAVE_CRITICAL_SECTION(hreg);
	return delete_status;
}
BP_ERROR_T ht_free_real ( P_BP_HASH_TABLE_REGISTRY hreg , void * ptr , BPLN_PARMS ) { BP_GLOBAL_HASH_TABLE_OVERRIDE ( ERR_FAILURE ) ; if ( ! hreg ) return ERR_FAILURE ; if ( ! ptr ) return ERR_FAILURE ; BP_HASH_TABLE_ENTER_CRITICAL_SECTION ( hreg ) ; P_BP_HASH_TABLE_MEM_PTR_ENTRY lookup_entry = NULL ; lookup_entry = ( P_BP_HASH_TABLE_MEM_PTR_ENTRY ) BP_HashRegMemPtrFind ( hreg , ptr ) ; if ( ! lookup_entry ) return ERR_FAILURE ; BP_ERROR_T delete_status = BP_HashRegDeleteMemoryEntry ( hreg , lookup_entry ) ; BP_HASH_TABLE_LEAVE_CRITICAL_SECTION ( hreg ) ; return delete_status ; }
Destroys memory allocated in the hash table
Destroys memory allocated in the hash table
// macro to override hreg on null // ensure we have a registry // ensure we hae a data pointer // enter critical section // attempt to lookup entries // attempt to lookup the entry based on the pointer // ensure we have a lookup entry // delete entry // printf("\n Deleting entry?: %p", lookup_entry); // leave critical section // return the error status