Remove CoreConfig use of memtables (bug 5899 part 1, r=fyren).
This commit is contained in:
parent
4500964394
commit
a25f9010cc
@ -124,7 +124,7 @@ void CoreConfig::OnSourceModAllInitialized()
|
||||
g_pOnAutoConfigsBuffered = g_Forwards.CreateForward("OnAutoConfigsBuffered", ET_Ignore, 0, NULL);
|
||||
}
|
||||
|
||||
CoreConfig::CoreConfig() : m_Strings(512)
|
||||
CoreConfig::CoreConfig()
|
||||
{
|
||||
}
|
||||
|
||||
@ -257,7 +257,6 @@ void CoreConfig::Initialize()
|
||||
|
||||
/* Reset cached key values */
|
||||
m_KeyValues.clear();
|
||||
m_Strings.Reset();
|
||||
|
||||
/* Parse config file */
|
||||
if ((err=textparsers->ParseFile_SMC(filePath, this, NULL)) != SMCError_Okay)
|
||||
@ -297,17 +296,18 @@ ConfigResult CoreConfig::SetConfigOption(const char *option, const char *value,
|
||||
pBase = pBase->m_pGlobalClassNext;
|
||||
}
|
||||
|
||||
m_KeyValues.replace(option, m_Strings.AddString(value));
|
||||
ke::AString vstr(value);
|
||||
m_KeyValues.replace(option, ke::Move(vstr));
|
||||
|
||||
return ConfigResult_Ignore;
|
||||
}
|
||||
|
||||
const char *CoreConfig::GetCoreConfigValue(const char *key)
|
||||
{
|
||||
int address;
|
||||
if (!m_KeyValues.retrieve(key, &address))
|
||||
StringHashMap<ke::AString>::Result r = m_KeyValues.find(key);
|
||||
if (!r.found())
|
||||
return NULL;
|
||||
return m_Strings.GetString(address);
|
||||
return r->value.chars();
|
||||
}
|
||||
|
||||
bool SM_AreConfigsExecuted()
|
||||
|
@ -35,8 +35,8 @@
|
||||
#include "sm_globals.h"
|
||||
#include <ITextParsers.h>
|
||||
#include <IRootConsoleMenu.h>
|
||||
#include <am-string.h>
|
||||
#include <sm_stringhashmap.h>
|
||||
#include "sm_memtable.h"
|
||||
|
||||
using namespace SourceMod;
|
||||
|
||||
@ -68,8 +68,7 @@ private:
|
||||
*/
|
||||
ConfigResult SetConfigOption(const char *option, const char *value, ConfigSource, char *Error, size_t maxlength);
|
||||
private:
|
||||
BaseStringTable m_Strings;
|
||||
StringHashMap<int> m_KeyValues;
|
||||
StringHashMap<ke::AString> m_KeyValues;
|
||||
};
|
||||
|
||||
extern bool SM_AreConfigsExecuted();
|
||||
|
@ -45,6 +45,7 @@ class AString
|
||||
: length_(0)
|
||||
{
|
||||
}
|
||||
|
||||
explicit AString(const char *str) {
|
||||
set(str, strlen(str));
|
||||
}
|
||||
@ -80,6 +81,12 @@ class AString
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
AString &operator =(Moveable<AString> other) {
|
||||
chars_ = other->chars_.take();
|
||||
length_ = other->length_;
|
||||
other->length_ = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
int compare(const char *str) const {
|
||||
return strcmp(chars(), str);
|
||||
|
Loading…
Reference in New Issue
Block a user