summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/ibm/locks.hpp5
-rw-r--r--include/ibm/management_console_rest.hpp28
2 files changed, 16 insertions, 17 deletions
diff --git a/include/ibm/locks.hpp b/include/ibm/locks.hpp
index 162abeeefa..e986f32f1e 100644
--- a/include/ibm/locks.hpp
+++ b/include/ibm/locks.hpp
@@ -188,8 +188,7 @@ class Lock
return lockObject;
}
- virtual ~Lock()
- {}
+ virtual ~Lock() = default;
};
inline bool Lock::createPersistentLockFilePath()
@@ -293,7 +292,7 @@ inline RcGetLockList Lock::getLockList(const ListOfSessionIds& listSessionId)
// Push the whole lock record into a vector for returning
// the json
- lockList.push_back(std::make_pair(it->first, it->second));
+ lockList.emplace_back(it->first, it->second);
}
// Go to next entry in map
it++;
diff --git a/include/ibm/management_console_rest.hpp b/include/ibm/management_console_rest.hpp
index c318cc6618..2c45693957 100644
--- a/include/ibm/management_console_rest.hpp
+++ b/include/ibm/management_console_rest.hpp
@@ -373,14 +373,14 @@ inline void handleAcquireLockAPI(const crow::Request& req, crow::Response& res,
// print lock request into journal
- for (uint32_t i = 0; i < lockRequestStructure.size(); i++)
+ for (auto& i : lockRequestStructure)
{
- BMCWEB_LOG_DEBUG << std::get<0>(lockRequestStructure[i]);
- BMCWEB_LOG_DEBUG << std::get<1>(lockRequestStructure[i]);
- BMCWEB_LOG_DEBUG << std::get<2>(lockRequestStructure[i]);
- BMCWEB_LOG_DEBUG << std::get<3>(lockRequestStructure[i]);
+ BMCWEB_LOG_DEBUG << std::get<0>(i);
+ BMCWEB_LOG_DEBUG << std::get<1>(i);
+ BMCWEB_LOG_DEBUG << std::get<2>(i);
+ BMCWEB_LOG_DEBUG << std::get<3>(i);
- for (const auto& p : std::get<4>(lockRequestStructure[i]))
+ for (const auto& p : std::get<4>(i))
{
BMCWEB_LOG_DEBUG << p.first << ", " << p.second;
}
@@ -443,10 +443,10 @@ inline void handleAcquireLockAPI(const crow::Request& req, crow::Response& res,
returnJson["LockType"] = std::get<2>(var.second);
returnJson["ResourceID"] = std::get<3>(var.second);
- for (uint32_t i = 0; i < std::get<4>(var.second).size(); i++)
+ for (auto& i : std::get<4>(var.second))
{
- segments["LockFlag"] = std::get<4>(var.second)[i].first;
- segments["SegmentLength"] = std::get<4>(var.second)[i].second;
+ segments["LockFlag"] = i.first;
+ segments["SegmentLength"] = i.second;
myarray.push_back(segments);
}
@@ -472,9 +472,9 @@ inline void
{
BMCWEB_LOG_DEBUG << listTransactionIds.size();
BMCWEB_LOG_DEBUG << "Data is present";
- for (uint32_t i = 0; i < listTransactionIds.size(); i++)
+ for (unsigned int listTransactionId : listTransactionIds)
{
- BMCWEB_LOG_DEBUG << listTransactionIds[i];
+ BMCWEB_LOG_DEBUG << listTransactionId;
}
// validate the request ids
@@ -518,10 +518,10 @@ inline void
returnJson["LockType"] = std::get<2>(var.second);
returnJson["ResourceID"] = std::get<3>(var.second);
- for (uint32_t i = 0; i < std::get<4>(var.second).size(); i++)
+ for (auto& i : std::get<4>(var.second))
{
- segments["LockFlag"] = std::get<4>(var.second)[i].first;
- segments["SegmentLength"] = std::get<4>(var.second)[i].second;
+ segments["LockFlag"] = i.first;
+ segments["SegmentLength"] = i.second;
myArray.push_back(segments);
}