From: <sv...@op...> - 2024-08-05 17:06:21
|
Author: sagamusix Date: Mon Aug 5 19:06:09 2024 New Revision: 21332 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21332 Log: [Ref] mpt::contains is always linear, go back to logarithmic search on set by using .find instead. [Ref] Silence warning about redundant null check. Modified: trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/soundlib/plugins/PluginManager.cpp Modified: trunk/OpenMPT/mptrack/Vstplug.cpp ============================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp Mon Aug 5 18:39:07 2024 (r21331) +++ trunk/OpenMPT/mptrack/Vstplug.cpp Mon Aug 5 19:06:09 2024 (r21332) @@ -263,7 +263,7 @@ while((childID = CVstPlugin::DispatchSEH(maskCrashes, *effect, Vst::effShellGetNextPlugin, 0, 0, name.data(), 0.0f, exception)) != 0) { name[63] = 0; - result.shellPlugins.emplace_back(LoadResult::ShellPlugin{name.data(), static_cast<uint32>(childID)}); + result.shellPlugins.push_back(LoadResult::ShellPlugin{name.data(), static_cast<uint32>(childID)}); if(static_cast<uint32>(childID) == plugin.shellPluginID) shellPlugIndex = result.shellPlugins.size(); Modified: trunk/OpenMPT/soundlib/plugins/PluginManager.cpp ============================================================================== --- trunk/OpenMPT/soundlib/plugins/PluginManager.cpp Mon Aug 5 18:39:07 2024 (r21331) +++ trunk/OpenMPT/soundlib/plugins/PluginManager.cpp Mon Aug 5 19:06:09 2024 (r21332) @@ -815,15 +815,12 @@ } updateFunc(*found, updateExisting); - if(found) - { - if(!first) - first = found; + if(!first) + first = found; #ifdef MODPLUG_TRACKER - found->WriteToCache(); + found->WriteToCache(); #endif // MODPLUG_TRACKER - } } // Are there any shell plugins in our list that are no longer part of the shell plugin? @@ -832,7 +829,7 @@ size_t deleted = 0; for(const auto &[id, i] : existingCandidates) { - if(!mpt::contains(containedIDs, id) && !pluginList[i - deleted]->pPluginsList) + if(auto it = containedIDs.find(id); it == containedIDs.end() && !pluginList[i - deleted]->pPluginsList) { MPT_ASSERT(pluginList[i - deleted]->shellPluginID == id); pluginList.erase(pluginList.begin() + i - deleted); |