PLUGINS: Don't call plugin->getType repeatedly

This commit is contained in:
Le Philousophe 2024-06-02 12:07:51 +02:00 committed by Eugene Sandulenko
parent 2645b1431c
commit 5ded4aedec

View File

@ -632,8 +632,9 @@ void PluginManager::addToPluginsInMemList(Plugin *plugin) {
// The plugin is valid, see if it provides the same module as an // The plugin is valid, see if it provides the same module as an
// already loaded one and should replace it. // already loaded one and should replace it.
PluginList::iterator pl = _pluginsInMem[plugin->getType()].begin(); PluginList &list = _pluginsInMem[plugin->getType()];
while (!found && pl != _pluginsInMem[plugin->getType()].end()) { PluginList::iterator pl = list.begin();
while (!found && pl != list.end()) {
if (!strcmp(plugin->getName(), (*pl)->getName())) { if (!strcmp(plugin->getName(), (*pl)->getName())) {
// Found a duplicated module. Replace the old one. // Found a duplicated module. Replace the old one.
found = true; found = true;
@ -647,7 +648,7 @@ void PluginManager::addToPluginsInMemList(Plugin *plugin) {
if (!found) { if (!found) {
// If it provides a new module, just add it to the list of known plugins in memory. // If it provides a new module, just add it to the list of known plugins in memory.
_pluginsInMem[plugin->getType()].push_back(plugin); list.push_back(plugin);
} }
} }