diff options
| author | Tom Englund <tomenglund26@gmail.com> | 2024-08-26 20:24:30 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-26 20:24:30 +0200 |
| commit | 72c7818ae66a18d126e2b4245d649fe3a93d3b8e (patch) | |
| tree | 194361ee0d4f92eea809b7904d39f02793c55e13 /src/plugins/PluginSystem.cpp | |
| parent | 1ea47950f4262ec1215087948c7275f8e0115af2 (diff) | |
misc: constify the remaining for loops (#7534)
now we roll loops at blazing constified speed.
Diffstat (limited to 'src/plugins/PluginSystem.cpp')
| -rw-r--r-- | src/plugins/PluginSystem.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/plugins/PluginSystem.cpp b/src/plugins/PluginSystem.cpp index 122faafd..0f1f97a2 100644 --- a/src/plugins/PluginSystem.cpp +++ b/src/plugins/PluginSystem.cpp @@ -98,27 +98,27 @@ void CPluginSystem::unloadPlugin(const CPlugin* plugin, bool eject) { exitFunc(); } - for (auto& [k, v] : plugin->registeredCallbacks) { + for (auto const& [k, v] : plugin->registeredCallbacks) { if (const auto SHP = v.lock()) g_pHookSystem->unhook(SHP); } const auto ls = plugin->registeredLayouts; - for (auto& l : ls) + for (auto const& l : ls) g_pLayoutManager->removeLayout(l); g_pFunctionHookSystem->removeAllHooksFrom(plugin->m_pHandle); const auto rd = plugin->registeredDecorations; - for (auto& d : rd) + for (auto const& d : rd) HyprlandAPI::removeWindowDecoration(plugin->m_pHandle, d); const auto rdi = plugin->registeredDispatchers; - for (auto& d : rdi) + for (auto const& d : rdi) HyprlandAPI::removeDispatcher(plugin->m_pHandle, d); const auto rhc = plugin->registeredHyprctlCommands; - for (auto& c : rhc) + for (auto const& c : rhc) HyprlandAPI::unregisterHyprCtlCommand(plugin->m_pHandle, c); g_pConfigManager->removePluginConfig(plugin->m_pHandle); @@ -139,7 +139,7 @@ void CPluginSystem::unloadPlugin(const CPlugin* plugin, bool eject) { } void CPluginSystem::unloadAllPlugins() { - for (auto& p : m_vLoadedPlugins | std::views::reverse) + for (auto const& p : m_vLoadedPlugins | std::views::reverse) unloadPlugin(p.get(), false); // Unload remaining plugins gracefully } @@ -147,7 +147,7 @@ std::vector<std::string> CPluginSystem::updateConfigPlugins(const std::vector<st std::vector<std::string> failures; // unload all plugins that are no longer present - for (auto& p : m_vLoadedPlugins | std::views::reverse) { + for (auto const& p : m_vLoadedPlugins | std::views::reverse) { if (p->m_bLoadedWithConfig && std::find(plugins.begin(), plugins.end(), p->path) == plugins.end()) { Debug::log(LOG, "Unloading plugin {} which is no longer present in config", p->path); unloadPlugin(p.get(), false); @@ -156,7 +156,7 @@ std::vector<std::string> CPluginSystem::updateConfigPlugins(const std::vector<st } // load all new plugins - for (auto& path : plugins) { + for (auto const& path : plugins) { if (std::find_if(m_vLoadedPlugins.begin(), m_vLoadedPlugins.end(), [&](const auto& other) { return other->path == path; }) == m_vLoadedPlugins.end()) { Debug::log(LOG, "Loading plugin {} which is now present in config", path); const auto plugin = loadPlugin(path); @@ -173,7 +173,7 @@ std::vector<std::string> CPluginSystem::updateConfigPlugins(const std::vector<st } CPlugin* CPluginSystem::getPluginByPath(const std::string& path) { - for (auto& p : m_vLoadedPlugins) { + for (auto const& p : m_vLoadedPlugins) { if (p->path == path) return p.get(); } @@ -182,7 +182,7 @@ CPlugin* CPluginSystem::getPluginByPath(const std::string& path) { } CPlugin* CPluginSystem::getPluginByHandle(HANDLE handle) { - for (auto& p : m_vLoadedPlugins) { + for (auto const& p : m_vLoadedPlugins) { if (p->m_pHandle == handle) return p.get(); } |
