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/extensions/openpower-pels/data_interface.cpp b/extensions/openpower-pels/data_interface.cpp
index 50424af..b812e97 100644
--- a/extensions/openpower-pels/data_interface.cpp
+++ b/extensions/openpower-pels/data_interface.cpp
@@ -268,8 +268,7 @@
auto reply = _bus.call(method, dbusTimeout);
- DBusPathList paths;
- reply.read(paths);
+ auto paths = reply.unpack<DBusPathList>();
return paths;
}
@@ -285,8 +284,7 @@
auto reply = _bus.call(method, dbusTimeout);
- std::map<DBusService, DBusInterfaceList> response;
- reply.read(response);
+ auto response = reply.unpack<std::map<DBusService, DBusInterfaceList>>();
if (!response.empty())
{
@@ -494,8 +492,7 @@
auto reply = _bus.call(method, dbusTimeout);
- std::string expandedLocationCode;
- reply.read(expandedLocationCode);
+ auto expandedLocationCode = reply.unpack<std::string>();
if (!connectorLoc.empty())
{
@@ -532,8 +529,7 @@
auto reply = _bus.call(method, dbusTimeout);
- std::vector<sdbusplus::message::object_path> entries;
- reply.read(entries);
+ auto entries = reply.unpack<std::vector<sdbusplus::message::object_path>>();
std::vector<std::string> paths;