cppcheck: Reduce scope of temp variable
Fixing this warning:
(style) The scope of the variable 'newStateID' can be reduced.
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: I41fc578f355c31dd89ea29ecad6905114f8200e1
diff --git a/chassis_state_manager.cpp b/chassis_state_manager.cpp
index a622d4e..e71e4b5 100644
--- a/chassis_state_manager.cpp
+++ b/chassis_state_manager.cpp
@@ -198,7 +198,6 @@
int Chassis::sysStateChange(sdbusplus::message::message& msg)
{
- uint32_t newStateID{};
sdbusplus::message::object_path newStateObjPath;
std::string newStateUnit{};
std::string newStateResult{};
@@ -206,6 +205,9 @@
// Read the msg and populate each variable
try
{
+ // newStateID is a throwaway that is needed in order to read the
+ // parameters that are useful out of the dbus message
+ uint32_t newStateID{};
msg.read(newStateID, newStateObjPath, newStateUnit, newStateResult);
}
catch (const SdBusError& e)