small optimization, fixed a corruption bug

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40298
This commit is contained in:
David Anderson 2007-01-15 22:09:11 +00:00
parent d74e35f1d5
commit f4cd98191e
3 changed files with 8 additions and 3 deletions

View File

@ -70,10 +70,10 @@ int BaseStringTable::AddString(const char *string)
return idx; return idx;
} }
const char *BaseStringTable::GetString(int str) /*const char *BaseStringTable::GetString(int str)
{ {
return (const char *)m_table.GetAddress(str); return (const char *)m_table.GetAddress(str);
} }*/
void BaseStringTable::Reset() void BaseStringTable::Reset()
{ {

View File

@ -46,7 +46,10 @@ public:
/** /**
* Given an index into the string table, returns the associated string. * 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 * Scraps the string table. For caching purposes, the memory

View File

@ -168,6 +168,8 @@ SMCParseResult CPluginInfoDatabase::ReadSMC_KeyValue(const char *key,
plugin->opts_size *= 2; plugin->opts_size *= 2;
} }
int newidx = memtab->CreateMem(plugin->opts_size * sizeof(PluginOpts), (void **)&table); 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) if (plugin->optarray != -1)
{ {
void *oldtable = memtab->GetAddress(plugin->optarray); void *oldtable = memtab->GetAddress(plugin->optarray);