Revert "Individualize NameHashSet Hashing & Revisit #709 (#740)"

This reverts commit 3803fbfe20.
This commit is contained in:
Michael Flaherty
2018-07-27 20:36:16 -07:00
parent 3803fbfe20
commit ece57df986
15 changed files with 40 additions and 99 deletions
+28 -3
View File
@@ -31,6 +31,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <ctype.h>
#include "PluginSys.h"
#include "ShareSys.h"
#include <ILibrarySys.h>
@@ -46,6 +47,7 @@
#include "frame_tasks.h"
#include <amtl/am-string.h>
#include <amtl/am-linkedlist.h>
#include <amtl/am-uniqueptr.h>
#include <bridge/include/IVEngineServerBridge.h>
#include <bridge/include/CoreProvider.h>
@@ -932,16 +934,38 @@ void CPluginManager::LoadPluginsFromDir(const char *basedir, const char *localpa
libsys->CloseDirectory(dir);
}
#if defined PLATFORM_WINDOWS || defined PLATFORM_APPLE
char *strdup_tolower(const char *input)
{
char *str = strdup(input);
for (char *c = str; *c; c++)
{
*c = tolower((unsigned char)*c);
}
return str;
}
#endif
LoadRes CPluginManager::LoadPlugin(CPlugin **aResult, const char *path, bool debug, PluginType type)
{
if (m_LoadingLocked)
return LoadRes_NeverLoad;
/* For windows & mac, we convert the path to lower-case in order to avoid duplicate plugin loading */
#if defined PLATFORM_WINDOWS || defined PLATFORM_APPLE
ke::UniquePtr<char> finalPath = ke::UniquePtr<char>(strdup_tolower(path));
#else
ke::UniquePtr<char> finalPath = ke::UniquePtr<char>(strdup(path));
#endif
/**
* Does this plugin already exist?
*/
CPlugin *pPlugin;
if (m_LoadLookup.retrieve(path, &pPlugin))
if (m_LoadLookup.retrieve(finalPath.get(), &pPlugin))
{
/* Check to see if we should try reloading it */
if (pPlugin->GetStatus() == Plugin_BadLoad
@@ -954,11 +978,12 @@ LoadRes CPluginManager::LoadPlugin(CPlugin **aResult, const char *path, bool deb
{
if (aResult)
*aResult = pPlugin;
return LoadRes_AlreadyLoaded;
}
}
CPlugin *plugin = CompileAndPrep(path);
CPlugin *plugin = CompileAndPrep(finalPath.get());
// Assign our outparam so we can return early. It must be set.
*aResult = plugin;
@@ -2391,4 +2416,4 @@ static OldPluginAPI sOldPluginAPI;
IPluginManager *CPluginManager::GetOldAPI()
{
return &sOldPluginAPI;
}
}