Make clang-tidy changes
clang-tidy has a number of checks it recommends. These checks are
documented in the next commit, but make the code pass our coding
standard.
Tested:
Minor changes made by the robot.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I6cfaab92211af9c4c1eccd981ba9fe7b8c523457
diff --git a/src/entity_manager.cpp b/src/entity_manager.cpp
index 4a730b0..bfda895 100644
--- a/src/entity_manager.cpp
+++ b/src/entity_manager.cpp
@@ -200,7 +200,7 @@
}
template <typename PropertyType>
-void addProperty(const std::string& propertyName, const PropertyType& value,
+void addProperty(const std::string& name, const PropertyType& value,
sdbusplus::asio::dbus_interface* iface,
nlohmann::json& systemConfiguration,
const std::string& jsonPointerString,
@@ -208,11 +208,11 @@
{
if (permission == sdbusplus::asio::PropertyPermission::readOnly)
{
- iface->register_property(propertyName, value);
+ iface->register_property(name, value);
return;
}
iface->register_property(
- propertyName, value,
+ name, value,
[&systemConfiguration,
jsonPointerString{std::string(jsonPointerString)}](
const PropertyType& newVal, PropertyType& val) {
@@ -282,7 +282,7 @@
if (value.type() == nlohmann::json::value_t::array)
{
array = true;
- if (!value.size())
+ if (value.empty())
{
continue;
}
@@ -461,8 +461,11 @@
for (const auto& item : data)
{
nlohmann::json& newJson = newData[item.first];
- std::visit([&newJson](auto&& val) { newJson = std::move(val); },
- item.second);
+ std::visit(
+ [&newJson](auto&& val) {
+ newJson = std::forward<decltype(val)>(val);
+ },
+ item.second);
}
auto findName = newData.find("Name");
@@ -708,7 +711,7 @@
else if (config.type() == nlohmann::json::value_t::array)
{
size_t index = 0;
- if (!config.size())
+ if (config.empty())
{
continue;
}
@@ -838,8 +841,8 @@
return false;
}
- auto ptr = powerState->get_ptr<const std::string*>();
- if (!ptr)
+ const auto* ptr = powerState->get_ptr<const std::string*>();
+ if (ptr == nullptr)
{
return false;
}