diff options
author | Patrick Venture <venture@google.com> | 2018-10-21 08:55:44 -0700 |
---|---|---|
committer | Patrick Venture <venture@google.com> | 2018-10-29 09:08:31 -0700 |
commit | c7eecc19632571319e39ab8e9f7500f7a5d1b245 (patch) | |
tree | e2697d1f2b184472214aa68ec85a54d0c2a963d6 /writefrudata.cpp | |
parent | ac988990848100c1c44e50c235d65f0c671f77bf (diff) | |
download | ipmi-fru-parser-c7eecc19632571319e39ab8e9f7500f7a5d1b245.tar.gz ipmi-fru-parser-c7eecc19632571319e39ab8e9f7500f7a5d1b245.zip |
writefrudata: add missing constness
Set iterator to const reference where possible.
Change-Id: I2d5d766990d49df3e6a6fef743698053413152fc
Signed-off-by: Patrick Venture <venture@google.com>
Diffstat (limited to 'writefrudata.cpp')
-rw-r--r-- | writefrudata.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/writefrudata.cpp b/writefrudata.cpp index cb0d8eb..4fbbf72 100644 --- a/writefrudata.cpp +++ b/writefrudata.cpp @@ -82,8 +82,8 @@ std::string getFRUValue(const std::string& section, const std::string& key, auto first = fruData.cbegin() + minIndexValue; auto last = first + (maxIndexValue - minIndexValue) + 1; - auto itr = - std::find_if(first, last, [&key](auto& e) { return key == e.first; }); + auto itr = std::find_if(first, last, + [&key](const auto& e) { return key == e.first; }); if (itr != last) { @@ -204,15 +204,15 @@ int updateInventory(FruAreaVector& area_vec, sd_bus* bus_sd) } ObjectMap objects; - for (auto& instance : instanceList) + for (const auto& instance : instanceList) { InterfaceMap interfaces; const auto& extrasIter = extras.find(instance.path); - for (auto& interfaceList : instance.interfaces) + for (const auto& interfaceList : instance.interfaces) { PropertyMap props; // store all the properties - for (auto& properties : interfaceList.second) + for (const auto& properties : interfaceList.second) { std::string value; decltype(auto) pdata = properties.second; @@ -595,7 +595,7 @@ int validateFRUArea(const uint8_t fruid, const char* fru_file_name, } #ifdef __IPMI_DEBUG__ - for (auto& iter : fru_area_vec) + for (const auto& iter : fru_area_vec) { std::printf("FRU ID : [%d]\n", iter->getFruID()); std::printf("AREA NAME : [%s]\n", iter->getName()); |