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/phosphor-power-supply/new_power_supply.cpp b/phosphor-power-supply/new_power_supply.cpp
index b3ba1c7..d35cbd8 100644
--- a/phosphor-power-supply/new_power_supply.cpp
+++ b/phosphor-power-supply/new_power_supply.cpp
@@ -848,8 +848,8 @@
void PowerSupply::inventoryAdded(sdbusplus::message_t& msg)
{
- sdbusplus::message::object_path path;
- msg.read(path);
+ auto path = msg.unpack<sdbusplus::message::object_path>();
+
// Make sure the signal is for the PSU inventory path
if (path == inventoryPath)
{