library/src/datastructures/BP-HashTable.cc
// Attempt to reallocate a managed chunk to an arbitrary non-zero size.
Attempt to reallocate a managed chunk to an arbitrary non-zero size.
Attempt to reallocate a managed chunk to an arbitrary non - zero size .
void * ht_realloc_real
(
		P_BP_HASH_TABLE_REGISTRY hreg,
		void * addr,
		size_t new_size,
		BPLN_PARMS
)
{
	BP_GLOBAL_HASH_TABLE_OVERRIDE(NULL);
	if(!hreg)
		return NULL;
	BP_HASH_TABLE_ENTER_CRITICAL_SECTION(hreg);
	if(!new_size)
		BP_HASH_TABLE_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(hreg, NULL);
	void * new_entry = NULL;
	if(!addr)
	{
		new_entry = ht_calloc(hreg, new_size, 1);
	}
	else
	{
		new_entry = BP_HashRegResizeMemoryEntry
		(
			hreg,
			addr,
			new_size,
			BPLN_PARMS_PASSTHROUGH
		);
		if(!new_entry)
			printf("\n UNABLE TO RESIZE ENTRY?!");
	}
	if(!new_entry)
		BP_HASH_TABLE_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(hreg, NULL);
	BP_HASH_TABLE_LEAVE_CRITICAL_SECTION(hreg);
	return new_entry;
}
void * ht_realloc_real ( P_BP_HASH_TABLE_REGISTRY hreg , void * addr , size_t new_size , BPLN_PARMS ) { BP_GLOBAL_HASH_TABLE_OVERRIDE ( NULL ) ; if ( ! hreg ) return NULL ; BP_HASH_TABLE_ENTER_CRITICAL_SECTION ( hreg ) ; if ( ! new_size ) BP_HASH_TABLE_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( hreg , NULL ) ; void * new_entry = NULL ; if ( ! addr ) { new_entry = ht_calloc ( hreg , new_size , 1 ) ; } else { new_entry = BP_HashRegResizeMemoryEntry ( hreg , addr , new_size , BPLN_PARMS_PASSTHROUGH ) ; if ( ! new_entry ) printf ( " \n " ) ; } if ( ! new_entry ) BP_HASH_TABLE_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( hreg , NULL ) ; BP_HASH_TABLE_LEAVE_CRITICAL_SECTION ( hreg ) ; return new_entry ; }
Attempt to reallocate a managed chunk to an arbitrary non-zero size.
Attempt to reallocate a managed chunk to an arbitrary non - zero size .
// macro to override hreg on null // ensure we have a registry // enter critical section // size must be set // new entry will either be a new allocation or a resize // if there is no address, create a new one // attempt to resize a memory entry // ensure we can add a new entry // leave critical section // return the new data