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: I9e1c7447883c0d80b47951ecb661304b8e8e84da
diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp
index b04bc2d..a6b37ef 100644
--- a/src/ethernet_interface.cpp
+++ b/src/ethernet_interface.cpp
@@ -601,8 +601,8 @@
try
{
auto reply = bus.get().call(method);
- std::variant<ServerList> response;
- reply.read(response);
+ auto response = reply.unpack<std::variant<ServerList>>();
+
servers = std::get<ServerList>(response);
}
catch (const sdbusplus::exception::SdBusError& e)