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/http/http_client.hpp b/http/http_client.hpp
index 571b5a9..ae077ef 100644
--- a/http/http_client.hpp
+++ b/http/http_client.hpp
@@ -93,11 +93,11 @@
std::function<void(bool, uint32_t, Response&)> callback;
RetryPolicyData retryPolicy;
PendingRequest(
- boost::beast::http::request<boost::beast::http::string_body>&& req,
- const std::function<void(bool, uint32_t, Response&)>& callback,
- const RetryPolicyData& retryPolicy) :
- req(std::move(req)),
- callback(callback), retryPolicy(retryPolicy)
+ boost::beast::http::request<boost::beast::http::string_body>&& reqIn,
+ const std::function<void(bool, uint32_t, Response&)>& callbackIn,
+ const RetryPolicyData& retryPolicyIn) :
+ req(std::move(reqIn)),
+ callback(callbackIn), retryPolicy(retryPolicyIn)
{}
};
@@ -394,11 +394,12 @@
}
public:
- explicit ConnectionInfo(boost::asio::io_context& ioc, const std::string& id,
- const std::string& destIP, const uint16_t destPort,
- const unsigned int connId) :
- subId(id),
- host(destIP), port(destPort), connId(connId), conn(ioc), timer(ioc)
+ explicit ConnectionInfo(boost::asio::io_context& ioc,
+ const std::string& idIn, const std::string& destIP,
+ const uint16_t destPort,
+ const unsigned int connIdIn) :
+ subId(idIn),
+ host(destIP), port(destPort), connId(connIdIn), conn(ioc), timer(ioc)
{}
};
@@ -598,11 +599,12 @@
}
public:
- explicit ConnectionPool(boost::asio::io_context& ioc, const std::string& id,
- const std::string& destIP,
- const uint16_t destPort) :
- ioc(ioc),
- id(id), destIP(destIP), destPort(destPort)
+ explicit ConnectionPool(boost::asio::io_context& iocIn,
+ const std::string& idIn,
+ const std::string& destIPIn,
+ const uint16_t destPortIn) :
+ ioc(iocIn),
+ id(idIn), destIP(destIPIn), destPort(destPortIn)
{
std::string clientKey = destIP + ":" + std::to_string(destPort);
BMCWEB_LOG_DEBUG << "Initializing connection pool for " << destIP << ":"