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: I23902026dee367a8cbf0c2725725c4ed3ca4d2bb
diff --git a/libipmid/utils.cpp b/libipmid/utils.cpp
index cc89844..02d6758 100644
--- a/libipmid/utils.cpp
+++ b/libipmid/utils.cpp
@@ -210,8 +210,9 @@
auto mapperResponseMsg = bus.call(mapperCall);
- std::map<std::string, std::vector<std::string>> mapperResponse;
- mapperResponseMsg.read(mapperResponse);
+ auto mapperResponse =
+ mapperResponseMsg
+ .unpack<std::map<std::string, std::vector<std::string>>>();
if (mapperResponse.begin() == mapperResponse.end())
{
@@ -230,8 +231,7 @@
mapperCall.append(subtreePath, depth, interfaces);
auto mapperReply = bus.call(mapperCall);
- ObjectTree objectTree;
- mapperReply.read(objectTree);
+ auto objectTree = mapperReply.unpack<ObjectTree>();
return objectTree;
}