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: Ied6b99a59bba28d1b0f2cea7896dbdaccb651f11
diff --git a/common/utils.cpp b/common/utils.cpp
index e2cbd50..13ac144 100644
--- a/common/utils.cpp
+++ b/common/utils.cpp
@@ -260,8 +260,8 @@
ObjectMapper::interface, "GetSubTree");
method.append(searchPath, depth, ifaceList);
auto reply = bus.call(method, dbusTimeout);
- GetSubTreeResponse response;
- reply.read(response);
+ auto response = reply.unpack<GetSubTreeResponse>();
+
return response;
}
@@ -290,8 +290,8 @@
ObjectMapper::interface, "GetAncestors");
method.append(path, ifaceList);
auto reply = bus.call(method, dbusTimeout);
- GetAncestorsResponse response;
- reply.read(response);
+ auto response = reply.unpack<GetAncestorsResponse>();
+
return response;
}
@@ -424,8 +424,8 @@
ObjectMapper::interface, "GetAssociatedSubTree");
method.append(objectPath, subtree, depth, ifaceList);
auto reply = bus.call(method, dbusTimeout);
- GetAssociatedSubTreeResponse response;
- reply.read(response);
+ auto response = reply.unpack<GetAssociatedSubTreeResponse>();
+
return response;
}