engine/zone.c
/*	Throw things out until the hunk can be expanded to the given point
*/
Throw things out until the hunk can be expanded to the given point
Throw things out until the hunk can be expanded to the given point
void Cache_FreeHigh (int new_high_hunk)
{
	cache_system_t	*c, *prev;
	prev = NULL;
	for(;;)
	{
		c = cache_head.prev;
		if (c == &cache_head)
			return;		
		if ( (byte *)c + c->size <= hunk_base + hunk_size - new_high_hunk)
			return;		
		if (prev && (c == prev))
			Cache_Free(c->user,TRUE);	
		else
		{
			Cache_Move (c);	
			prev = c;
		}
	}
}
void Cache_FreeHigh ( int new_high_hunk ) { cache_system_t * c , * prev ; prev = NULL ; for ( ; ; ) { c = cache_head . prev ; if ( c == & cache_head ) return ; if ( ( byte * ) c + c -> size <= hunk_base + hunk_size - new_high_hunk ) return ; if ( prev && ( c == prev ) ) Cache_Free ( c -> user , TRUE ) ; else { Cache_Move ( c ) ; prev = c ; } } }
Throw things out until the hunk can be expanded to the given point
Throw things out until the hunk can be expanded to the given point
// nothing in cache at all // there is space to grow the hunk // didn't move out of the way //johnfitz -- added second argument // try to move it