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 <IGameConfigs.h>
#include <ITextParsers.h> #include <ITextParsers.h>
#include "sm_memtable.h" #include "sm_memtable.h"
#include <sm_trie_tpl.h>
#include <am-refcounting.h> #include <am-refcounting.h>
#include <sm_stringhashmap.h> #include <sm_stringhashmap.h>
#include <sm_namehashset.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 * SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved. * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
@ -240,21 +240,14 @@ HandleType_t HandleSystem::CreateType(const char *name,
return index; 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); QHandleType *type;
if (!m_TypeLookup.retrieve(name, &type))
if (!typepp)
{
return false; return false;
}
unsigned int offset = *typepp - m_Types; if (aResult)
*aResult = type - m_Types;
if (type)
{
*type = offset;
}
return true; return true;
} }

View File

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