Improve loops & fix cpp check warning
- This commit improves certain while loops to range based for loops.
- This commit also fixes the cppcheck warning that mentions about
performance issues when using postfix operators on non-primitive
types.
Tested By:
- A function is unittested.
- GET on both EthernetInterfaces & certificate service
looks good without any issues.
Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
Change-Id: I85420f7bf9af45a97e1a93b916f292c2516f5802
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index 5dc1e1f..81d9d05 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -516,7 +516,7 @@
std::string_view::iterator tokenBegin = i;
while (i != value.end() && *i != '=')
{
- i++;
+ ++i;
}
if (i == value.end())
{
@@ -524,11 +524,11 @@
}
const std::string_view key(tokenBegin,
static_cast<size_t>(i - tokenBegin));
- i++;
+ ++i;
tokenBegin = i;
while (i != value.end() && *i != ',')
{
- i++;
+ ++i;
}
const std::string_view val(tokenBegin,
static_cast<size_t>(i - tokenBegin));
@@ -559,7 +559,7 @@
// skip comma character
if (i != value.end())
{
- i++;
+ ++i;
}
}
}