From 0a1ae48a9fd6eb76baad27de98c00f653a55e4ac Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Thu, 23 Jan 2025 21:55:41 +0100 Subject: core: move all shared_ptrs from the STL to hyprutils (#9143) --- src/plugins/HookSystem.cpp | 2 +- src/plugins/HookSystem.hpp | 8 ++++---- src/plugins/PluginAPI.cpp | 2 +- src/plugins/PluginAPI.hpp | 2 +- src/plugins/PluginSystem.cpp | 4 ++-- src/plugins/PluginSystem.hpp | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/HookSystem.cpp b/src/plugins/HookSystem.cpp index c19f6f46..9fa61561 100644 --- a/src/plugins/HookSystem.cpp +++ b/src/plugins/HookSystem.cpp @@ -253,7 +253,7 @@ bool CFunctionHook::unhook() { } CFunctionHook* CHookSystem::initHook(HANDLE owner, void* source, void* destination) { - return m_vHooks.emplace_back(std::make_unique(owner, source, destination)).get(); + return m_vHooks.emplace_back(makeUnique(owner, source, destination)).get(); } bool CHookSystem::removeHook(CFunctionHook* hook) { diff --git a/src/plugins/HookSystem.hpp b/src/plugins/HookSystem.hpp index f0a5a11d..93ca4ff5 100644 --- a/src/plugins/HookSystem.hpp +++ b/src/plugins/HookSystem.hpp @@ -2,7 +2,7 @@ #include #include -#include +#include "../helpers/memory/Memory.hpp" #define HANDLE void* #define HOOK_TRAMPOLINE_MAX_SIZE 64 @@ -60,9 +60,9 @@ class CHookSystem { void removeAllHooksFrom(HANDLE handle); private: - std::vector> m_vHooks; + std::vector> m_vHooks; - uint64_t getAddressForTrampo(); + uint64_t getAddressForTrampo(); struct SAllocatedPage { uint64_t addr = 0; @@ -75,4 +75,4 @@ class CHookSystem { friend class CFunctionHook; }; -inline std::unique_ptr g_pFunctionHookSystem; \ No newline at end of file +inline UP g_pFunctionHookSystem; \ No newline at end of file diff --git a/src/plugins/PluginAPI.cpp b/src/plugins/PluginAPI.cpp index fbb1ec1b..92f043fd 100644 --- a/src/plugins/PluginAPI.cpp +++ b/src/plugins/PluginAPI.cpp @@ -106,7 +106,7 @@ APICALL bool HyprlandAPI::removeFunctionHook(HANDLE handle, CFunctionHook* hook) return g_pFunctionHookSystem->removeHook(hook); } -APICALL bool HyprlandAPI::addWindowDecoration(HANDLE handle, PHLWINDOW pWindow, std::unique_ptr pDecoration) { +APICALL bool HyprlandAPI::addWindowDecoration(HANDLE handle, PHLWINDOW pWindow, UP pDecoration) { auto* const PLUGIN = g_pPluginSystem->getPluginByHandle(handle); if (!PLUGIN) diff --git a/src/plugins/PluginAPI.hpp b/src/plugins/PluginAPI.hpp index 96c32bf1..c8c9e563 100644 --- a/src/plugins/PluginAPI.hpp +++ b/src/plugins/PluginAPI.hpp @@ -223,7 +223,7 @@ namespace HyprlandAPI { returns: true on success. False otherwise. */ - APICALL bool addWindowDecoration(HANDLE handle, PHLWINDOW pWindow, std::unique_ptr pDecoration); + APICALL bool addWindowDecoration(HANDLE handle, PHLWINDOW pWindow, UP pDecoration); /* Removes a window decoration diff --git a/src/plugins/PluginSystem.cpp b/src/plugins/PluginSystem.cpp index e849bf11..87b9e8ef 100644 --- a/src/plugins/PluginSystem.cpp +++ b/src/plugins/PluginSystem.cpp @@ -8,7 +8,7 @@ #include "../managers/eventLoop/EventLoopManager.hpp" CPluginSystem::CPluginSystem() { - g_pFunctionHookSystem = std::make_unique(); + g_pFunctionHookSystem = makeUnique(); } CPlugin* CPluginSystem::loadPlugin(const std::string& path) { @@ -21,7 +21,7 @@ CPlugin* CPluginSystem::loadPlugin(const std::string& path) { return nullptr; } - auto* const PLUGIN = m_vLoadedPlugins.emplace_back(std::make_unique()).get(); + auto* const PLUGIN = m_vLoadedPlugins.emplace_back(makeUnique()).get(); PLUGIN->path = path; diff --git a/src/plugins/PluginSystem.hpp b/src/plugins/PluginSystem.hpp index 336c484d..95841bef 100644 --- a/src/plugins/PluginSystem.hpp +++ b/src/plugins/PluginSystem.hpp @@ -44,9 +44,9 @@ class CPluginSystem { std::string m_szLastError = ""; private: - std::vector> m_vLoadedPlugins; + std::vector> m_vLoadedPlugins; - jmp_buf m_jbPluginFaultJumpBuf; + jmp_buf m_jbPluginFaultJumpBuf; }; -inline std::unique_ptr g_pPluginSystem; +inline UP g_pPluginSystem; -- cgit v1.2.3