use sdbusplus unpack syntax
Rather than defining a variable and then reading it from a message,
sdbusplus also supports directly unpack-ing from the message. Use
this syntax instead as it is more efficient and succinct.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I1f4272333853a3da9c27cd927ee0997c81bc6330
diff --git a/include/watchdog_event_monitor.hpp b/include/watchdog_event_monitor.hpp
index 57ba24e..4c53e06 100644
--- a/include/watchdog_event_monitor.hpp
+++ b/include/watchdog_event_monitor.hpp
@@ -241,8 +241,7 @@
std::shared_ptr<sdbusplus::asio::connection> conn)
{
auto watchdogEventMatcherCallback = [conn](sdbusplus::message_t& msg) {
- std::string expiredAction;
- msg.read(expiredAction);
+ auto expiredAction = msg.unpack<std::string>();
std::string_view action = expiredAction;
action.remove_prefix(