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: I2516cfa21eaf0fc51902f2b23d4a54241e9d4978
diff --git a/lib/elog.cpp b/lib/elog.cpp
index 70d1ced..f506e81 100644
--- a/lib/elog.cpp
+++ b/lib/elog.cpp
@@ -35,8 +35,8 @@
msg.append(id, name);
auto bus = sdbusplus::bus::new_default();
auto reply = bus.call(msg);
- uint32_t entryID;
- reply.read(entryID);
+ auto entryID = reply.unpack<uint32_t>();
+
return entryID;
}
@@ -47,8 +47,8 @@
msg.append(id, name, static_cast<uint32_t>(level));
auto bus = sdbusplus::bus::new_default();
auto reply = bus.call(msg);
- uint32_t entryID;
- reply.read(entryID);
+ auto entryID = reply.unpack<uint32_t>();
+
return entryID;
}
} // namespace details