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: Ia8fd88354883f8a91310de477abeef444fa6bc5f
diff --git a/utility.cpp b/utility.cpp
index 53fe965..94de833 100644
--- a/utility.cpp
+++ b/utility.cpp
@@ -47,8 +47,8 @@
auto reply = bus.call(method);
- std::map<std::string, std::vector<std::string>> response;
- reply.read(response);
+ auto response =
+ reply.unpack<std::map<std::string, std::vector<std::string>>>();
if (response.empty())
{
@@ -106,8 +106,8 @@
auto reply = bus.call(mapperCall);
- DbusSubtree response;
- reply.read(response);
+ auto response = reply.unpack<DbusSubtree>();
+
return response;
}
@@ -127,8 +127,8 @@
auto reply = bus.call(mapperCall);
- std::vector<DbusPath> response;
- reply.read(response);
+ auto response = reply.unpack<std::vector<DbusPath>>();
+
return response;
}