示例#1
0
/*
* ML_Shutdown
* Free map list memory
*/
void ML_Shutdown( void )
{
	mapinfo_t *map;

	if( !ml_initialized )
		return;

	ML_BuildCache();

	ml_initialized = false;

	Cmd_RemoveCommand( "maplist" );

	Trie_Destroy( mlist_filenames_trie );
	Trie_Destroy( mlist_fullnames_trie );

	while( maplist )
	{
		map = maplist;
		maplist = map->next;
		Mem_ZoneFree( map );
	}

	ml_flush = true;
}
示例#2
0
void Dynvar_Shutdown( void )
{
	if( dynvar_initialized )
	{
		struct trie_dump_s *dump;
		unsigned int i;

		assert( dynvar_trie );

		Cmd_RemoveCommand( "dynvarlist" );
		Cmd_RemoveCommand( "setdyn" );

		Trie_Dump( dynvar_trie, "", TRIE_DUMP_VALUES, &dump );
		for( i = 0; i < dump->size; i++ )
		{
			Dynvar_Destroy( (dynvar_t *)dump->key_value_vector[i].value );
		}
		Trie_FreeDump( dump );

		dynvar_initialized = qfalse;
	}

	if( dynvar_preinitialized )
	{
		assert( dynvar_trie );

		Trie_Destroy( dynvar_trie );
		dynvar_trie = NULL;

		dynvar_preinitialized = qfalse;
	}
}
示例#3
0
/*
* L10n_DestroyPODict
*/
static void L10n_DestroyPODict( podict_t *podict )
{
	if( !podict ) {
		return;
	}
	if( podict->trie ) {
		Trie_Destroy( podict->trie );
	}
	L10n_Free( podict );
}
示例#4
0
/*
* CL_MasterAddressCache_Shutdown
*/
static void CL_MasterAddressCache_Shutdown( void )
{
	masteradrcache_t *next;

	// free allocated memory
	Trie_Destroy( serverlist_masters_trie );
	while( serverlist_masters_head )
	{
		next = serverlist_masters_head->next;
		Mem_ZoneFree( serverlist_masters_head );
		serverlist_masters_head = next;
	}
}
示例#5
0
/*
* CL_MasterAddressCache_Shutdown
*/
static void CL_MasterAddressCache_Shutdown( void )
{
	unsigned i;
	trie_dump_t *dump;

	if( resolverThreads ) {
		for( i = 0; resolverThreads[i]; i++ ) {
			QThread_Join( resolverThreads[i] );
		}
		free( resolverThreads );
		resolverThreads = NULL;
	}

	QMutex_Destroy( &resolveLock );

	// free allocated memory
	Trie_Dump( serverlist_masters_trie, "", TRIE_DUMP_BOTH, &dump );
	for( i = 0; i < dump->size; ++i ) {
		free( dump->key_value_vector[i].value );
	}
	Trie_Destroy( serverlist_masters_trie );
}
示例#6
0
/*
* Cvar_Shutdown
* 
* Reads in all archived cvars
*/
void Cvar_Shutdown( void )
{
	if( cvar_initialized )
	{
		unsigned int i;
		struct trie_dump_s *dump;
		extern cvar_t *developer, *developerMemory;
#ifndef DEDICATED_ONLY
		extern cvar_t *con_printText;
#endif

		assert( cvar_trie );

		// NULL out some console variables so that we won't try to read from
		// the memory pointers after the data has already been freed but before we
		// reset the pointers to NULL
		developer = NULL;
		developerMemory = NULL;
		dedicated = NULL;
#ifndef DEDICATED_ONLY
		con_printText = NULL;
#endif

		Cmd_RemoveCommand( "set" );
		Cmd_RemoveCommand( "seta" );
		Cmd_RemoveCommand( "setau" );
		Cmd_RemoveCommand( "setas" );
		Cmd_RemoveCommand( "setu" );
		Cmd_RemoveCommand( "sets" );
		Cmd_RemoveCommand( "reset" );
		Cmd_RemoveCommand( "toggle" );
		Cmd_RemoveCommand( "cvarlist" );
#ifndef PUBLIC_BUILD
		Cmd_RemoveCommand( "cvararchivelist" );
#endif

		Trie_Dump( cvar_trie, "", TRIE_DUMP_VALUES, &dump );
		for( i = 0; i < dump->size; ++i )
		{
			cvar_t *const var = dump->key_value_vector[i].value;

			if( var->string )
				Mem_ZoneFree( var->string );
			if( var->dvalue )
				Mem_ZoneFree( var->dvalue );
			Mem_ZoneFree( var );
		}
		Trie_FreeDump( dump );

		cvar_initialized = qfalse;
	}

	if( cvar_preinitialized )
	{
		assert( cvar_trie );

		Trie_Destroy( cvar_trie );
		cvar_trie = NULL;

		cvar_preinitialized = qfalse;
	}
}