Switch HandleSys off KTrie (bug 5884 part 2, r=ds).

This commit is contained in:
David Anderson 2013-08-25 11:59:45 -07:00
parent 0144062126
commit 544b6d94aa
3 changed files with 9 additions and 17 deletions

View File

@ -36,7 +36,6 @@
#include <IGameConfigs.h>
#include <ITextParsers.h>
#include "sm_memtable.h"
#include <sm_trie_tpl.h>
#include <am-refcounting.h>
#include <sm_stringhashmap.h>
#include <sm_namehashset.h>

View File

@ -1,5 +1,5 @@
/**
* vim: set ts=4 :
* vim: set ts=4 sw=4 tw=99 noet :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
@ -240,21 +240,14 @@ HandleType_t HandleSystem::CreateType(const char *name,
return index;
}
bool HandleSystem::FindHandleType(const char *name, HandleType_t *type)
bool HandleSystem::FindHandleType(const char *name, HandleType_t *aResult)
{
QHandleType **typepp = m_TypeLookup.retrieve(name);
if (!typepp)
{
QHandleType *type;
if (!m_TypeLookup.retrieve(name, &type))
return false;
}
unsigned int offset = *typepp - m_Types;
if (type)
{
*type = offset;
}
if (aResult)
*aResult = type - m_Types;
return true;
}

View File

@ -1,5 +1,5 @@
/**
* vim: set ts=4 :
* vim: set ts=4 sw=4 tw=99 noet :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
@ -34,7 +34,7 @@
#include <IHandleSys.h>
#include <stdio.h>
#include <sm_trie_tpl.h>
#include <sm_stringhashmap.h>
#include "sm_memtable.h"
#include "common_logic.h"
@ -216,7 +216,7 @@ protected:
private:
QHandle *m_Handles;
QHandleType *m_Types;
KTrie<QHandleType *> m_TypeLookup;
StringHashMap<QHandleType *> m_TypeLookup;
unsigned int m_TypeTail;
unsigned int m_FreeTypes;
unsigned int m_HandleTail;