diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-04-05 22:57:45 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-04-05 22:57:45 +0000 |
commit | 0cd6f180701a35abe5da0f4b0272b3047c03e330 (patch) | |
tree | b125489be5670eb775dd43f96236744eaedf9ef3 /plugins/Dbx_kv/src/dbmodulechain.cpp | |
parent | 56e1f721234e3f6d1ef3eb8cff2dc3f322c2b831 (diff) |
various speed optimizations
git-svn-id: http://svn.miranda-ng.org/main/trunk@12621 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_kv/src/dbmodulechain.cpp')
-rw-r--r-- | plugins/Dbx_kv/src/dbmodulechain.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/plugins/Dbx_kv/src/dbmodulechain.cpp b/plugins/Dbx_kv/src/dbmodulechain.cpp index d1491fc68a..2f6b71e401 100644 --- a/plugins/Dbx_kv/src/dbmodulechain.cpp +++ b/plugins/Dbx_kv/src/dbmodulechain.cpp @@ -70,10 +70,15 @@ int CDbxKV::InitModuleNames(void) DWORD CDbxKV::FindExistingModuleNameOfs(const char *szName)
{
ModuleName mn = { (char*)szName, 0 };
+ if (m_lastmn && !strcmp(mn.name, m_lastmn->name))
+ return m_lastmn->ofs;
int index = m_lMods.getIndex(&mn);
- if (index != -1)
- return m_lMods[index]->ofs;
+ if (index != -1) {
+ ModuleName *pmn = m_lMods[index];
+ m_lastmn = pmn;
+ return pmn->ofs;
+ }
return 0;
}
@@ -112,10 +117,16 @@ DWORD CDbxKV::GetModuleNameOfs(const char *szName) char* CDbxKV::GetModuleNameByOfs(DWORD ofs)
{
+ if (m_lastmn && m_lastmn->ofs == ofs)
+ return m_lastmn->name;
+
ModuleName mn = { NULL, ofs };
int index = m_lOfs.getIndex(&mn);
- if (index != -1)
- return m_lOfs[index]->name;
+ if (index != -1) {
+ ModuleName *pmn = m_lOfs[index];
+ m_lastmn = pmn;
+ return pmn->name;
+ }
return NULL;
}
|