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/inventory_mac.cpp b/src/inventory_mac.cpp
index 67e8dff..fb15e67 100644
--- a/src/inventory_mac.cpp
+++ b/src/inventory_mac.cpp
@@ -103,8 +103,7 @@
}
}();
- ObjectTree objectTree;
- mapperReply.read(objectTree);
+ auto objectTree = mapperReply.unpack<ObjectTree>();
if (objectTree.empty())
{
@@ -164,8 +163,8 @@
}
}();
- std::variant<std::string> value;
- reply.read(value);
+ auto value = reply.unpack<std::variant<std::string>>();
+
return stdplus::fromStr<stdplus::EtherAddr>(std::get<std::string>(value));
}