library/src/datastructures/BP-HashTable.cc
// Attempts to delete all the memory entries in a registry.  This should
// be only used during the destruction of the entire hash table registry;
// failing to heed this warning and attempting to use it yourself can
// very easily lead to a corruption, as hive entries correlate to memory
// entries, and if a hive entry is missing a memory entry, it causes a
// bad reference.  READ THIS WHOLE TEXT BLOCK.
Attempts to delete all the memory entries in a registry.  This should
be only used during the destruction of the entire hash table registry;
failing to heed this warning and attempting to use it yourself can
very easily lead to a corruption, as hive entries correlate to memory
entries, and if a hive entry is missing a memory entry, it causes a
bad reference.  READ THIS WHOLE TEXT BLOCK.
Attempts to delete all the memory entries in a registry . This should be only used during the destruction of the entire hash table registry ; failing to heed this warning and attempting to use it yourself can very easily lead to a corruption as hive entries correlate to memory entries and if a hive entry is missing a memory entry it causes a bad reference . READ THIS WHOLE TEXT BLOCK .
BP_ERROR_T BP_HashRegDeleteAllMemoryEntries
(
	P_BP_HASH_TABLE_REGISTRY      hreg
)
{
	BP_GLOBAL_HASH_TABLE_OVERRIDE(ERR_FAILURE);
	if(!hreg->memory_table)
		return ERR_FAILURE;
	if(!hreg->memory_table->entries)
		return ERR_FAILURE;
	P_BP_HASH_TABLE_MEM memory_table = hreg->memory_table;
	P_BP_HASH_TABLE_MEM_PTR_ENTRY tmp_entry   = NULL;
	P_BP_HASH_TABLE_MEM_PTR_ENTRY tmp_entries = NULL;
	P_BP_HASH_TABLE_MEM_PTR_ENTRY current_entry = NULL;
	P_BP_HASH_TABLE_MEM_PTR_ENTRY entry_to_delete = NULL;
	size_t idx_iter = 0;
	do
	{
		entry_to_delete = NULL;
		if(!hreg->memory_table->entries)
			break;
		HASH_ITER(hh,hreg->memory_table->entries, current_entry, tmp_entry)
		{
			entry_to_delete = current_entry;
			if(entry_to_delete)
				break;
		}
		if(!entry_to_delete)
			break;
		BP_HashRegDeleteMemoryEntry(hreg, entry_to_delete);
	}
	while (entry_to_delete);
	return ERR_SUCCESS;
}
BP_ERROR_T BP_HashRegDeleteAllMemoryEntries ( P_BP_HASH_TABLE_REGISTRY hreg ) { BP_GLOBAL_HASH_TABLE_OVERRIDE ( ERR_FAILURE ) ; if ( ! hreg -> memory_table ) return ERR_FAILURE ; if ( ! hreg -> memory_table -> entries ) return ERR_FAILURE ; P_BP_HASH_TABLE_MEM memory_table = hreg -> memory_table ; P_BP_HASH_TABLE_MEM_PTR_ENTRY tmp_entry = NULL ; P_BP_HASH_TABLE_MEM_PTR_ENTRY tmp_entries = NULL ; P_BP_HASH_TABLE_MEM_PTR_ENTRY current_entry = NULL ; P_BP_HASH_TABLE_MEM_PTR_ENTRY entry_to_delete = NULL ; size_t idx_iter = 0 ; do { entry_to_delete = NULL ; if ( ! hreg -> memory_table -> entries ) break ; HASH_ITER ( hh , hreg -> memory_table -> entries , current_entry , tmp_entry ) { entry_to_delete = current_entry ; if ( entry_to_delete ) break ; } if ( ! entry_to_delete ) break ; BP_HashRegDeleteMemoryEntry ( hreg , entry_to_delete ) ; } while ( entry_to_delete ) ; return ERR_SUCCESS ; }
Attempts to delete all the memory entries in a registry.
Attempts to delete all the memory entries in a registry .
// macro to override hreg on null // ensure we have a memory table // memory table // tmp entries // current entry // this entry will be deleted // index position iterator[ // reset entry // break if the pointer is null // retrieve entry from fresh position (prevents corruption) // check to ensure we have a current entry // exit loop if we have no more entries // delete the current entry // return indicating success