Enable readability-avoid-const-params-in-decls
This check involves explicitly declaring variables const when they're
declared auto, which helps in readability, and makes it more clear that
the variables are const.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I71198ea03850384a389a56ad26f2c4a48c75b148
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index e4e5eb9..f4260a8 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -450,7 +450,7 @@
// Check if proper pattern for object path appears
if (boost::starts_with(objpath.first.str, ipv6PathStart))
{
- for (auto& interface : objpath.second)
+ for (const auto& interface : objpath.second)
{
if (interface.first == "xyz.openbmc_project.Network.IP")
{
@@ -463,7 +463,7 @@
IPv6AddressData& ipv6Address = *it.first;
ipv6Address.id =
objpath.first.str.substr(ipv6PathStart.size());
- for (auto& property : interface.second)
+ for (const auto& property : interface.second)
{
if (property.first == "Address")
{
@@ -528,7 +528,7 @@
// Check if proper pattern for object path appears
if (boost::starts_with(objpath.first.str, ipv4PathStart))
{
- for (auto& interface : objpath.second)
+ for (const auto& interface : objpath.second)
{
if (interface.first == "xyz.openbmc_project.Network.IP")
{
@@ -541,7 +541,7 @@
IPv4AddressData& ipv4Address = *it.first;
ipv4Address.id =
objpath.first.str.substr(ipv4PathStart.size());
- for (auto& property : interface.second)
+ for (const auto& property : interface.second)
{
if (property.first == "Address")
{
@@ -1782,7 +1782,7 @@
nlohmann::json& ipv4StaticArray = jsonResponse["IPv4StaticAddresses"];
ipv4Array = nlohmann::json::array();
ipv4StaticArray = nlohmann::json::array();
- for (auto& ipv4Config : ipv4Data)
+ for (const auto& ipv4Config : ipv4Data)
{
std::string gatewayStr = ipv4Config.gateway;
@@ -1819,7 +1819,7 @@
nlohmann::json& ipv6AddrPolicyTable =
jsonResponse["IPv6AddressPolicyTable"];
ipv6AddrPolicyTable = nlohmann::json::array();
- for (auto& ipv6Config : ipv6Data)
+ for (const auto& ipv6Config : ipv6Data)
{
ipv6Array.push_back({{"Address", ipv6Config.address},
{"PrefixLength", ipv6Config.prefixLength},