Fix shadowed variable issues
This patchset is the conclusion of a multi-year effort to try to fix
shadowed variable names. Variables seem to be shadowed all over, and in
most places they exist, there's a "code smell" of things that aren't
doing what the author intended.
This commit attempts to clean up these in several ways by:
1. Renaming variables where appropriate.
2. Preferring to refer to member variables directly when operating
within a class
3. Rearranging code so that pass through variables are handled in the
calling scope, rather than passing them through.
These patterns are applied throughout the codebase, to the point where
-Wshadow can be enabled in meson.build.
Tested: Code compiles, unit tests pass. Still need to run redfish
service validator.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: If703398c2282f9e096ca2694fd94515de36a098b
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index 33769a0..c9fb4a1 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -141,10 +141,10 @@
{
if (property.first == "Activation")
{
- const std::string* state =
+ const std::string* activationState =
std::get_if<std::string>(
&property.second);
- if (state == nullptr)
+ if (activationState == nullptr)
{
taskData->messages.emplace_back(
messages::internalError());
@@ -201,10 +201,10 @@
{
if (property.first == "Progress")
{
- const std::string* progress =
+ const std::string* progressStr =
std::get_if<std::string>(
&property.second);
- if (progress == nullptr)
+ if (progressStr == nullptr)
{
taskData->messages.emplace_back(
messages::internalError());