From f4cd98191e8365d157a021b8ba86bcb1290dce44 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 15 Jan 2007 22:09:11 +0000 Subject: [PATCH] small optimization, fixed a corruption bug --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40298 --- core/sm_memtable.cpp | 4 ++-- core/sm_memtable.h | 5 ++++- core/systems/PluginInfoDatabase.cpp | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/core/sm_memtable.cpp b/core/sm_memtable.cpp index f2f4ad63..dc15dff2 100644 --- a/core/sm_memtable.cpp +++ b/core/sm_memtable.cpp @@ -70,10 +70,10 @@ int BaseStringTable::AddString(const char *string) return idx; } -const char *BaseStringTable::GetString(int str) +/*const char *BaseStringTable::GetString(int str) { return (const char *)m_table.GetAddress(str); -} +}*/ void BaseStringTable::Reset() { diff --git a/core/sm_memtable.h b/core/sm_memtable.h index 0fe631a9..35066982 100644 --- a/core/sm_memtable.h +++ b/core/sm_memtable.h @@ -46,7 +46,10 @@ public: /** * Given an index into the string table, returns the associated string. */ - const char *GetString(int str); + inline const char *GetString(int str) + { + return (const char *)m_table.GetAddress(str); + } /** * Scraps the string table. For caching purposes, the memory diff --git a/core/systems/PluginInfoDatabase.cpp b/core/systems/PluginInfoDatabase.cpp index 3783bf4b..47d04d8e 100644 --- a/core/systems/PluginInfoDatabase.cpp +++ b/core/systems/PluginInfoDatabase.cpp @@ -168,6 +168,8 @@ SMCParseResult CPluginInfoDatabase::ReadSMC_KeyValue(const char *key, plugin->opts_size *= 2; } int newidx = memtab->CreateMem(plugin->opts_size * sizeof(PluginOpts), (void **)&table); + /* in case it resized */ + plugin = (PluginSettings *)memtab->GetAddress(cur_plugin); if (plugin->optarray != -1) { void *oldtable = memtab->GetAddress(plugin->optarray);