events: remove std::function for hook
Using std::function causes a potential constructor / destructor
pair to be created. Since this pair is created in the library
registering the event [hook], it is both overhead and a potential
avenue of library load ordering issues. Switch to a simpler raw
function pointer instead.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I3948dc10a461384af07d7c0d7a675e2e046bc6ae
diff --git a/include/sdbusplus/sdbuspp_support/event.hpp b/include/sdbusplus/sdbuspp_support/event.hpp
index eea8947..2a5e467 100644
--- a/include/sdbusplus/sdbuspp_support/event.hpp
+++ b/include/sdbusplus/sdbuspp_support/event.hpp
@@ -8,8 +8,8 @@
namespace sdbusplus::sdbuspp
{
-using register_hook =
- std::function<void(const nlohmann::json&, const std::source_location&)>;
+using register_hook = void (*)(const nlohmann::json&,
+ const std::source_location&);
void register_event(const std::string&, register_hook);