fix more push vs emplace calls
It seems like clang-tidy doesn't catch every place that an emplace could
be used instead of a push. Use a few grep/sed pairs to find and fix up
some common patterns.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I93eaec26b8e3be240599e92b66cf54947073dc4c
diff --git a/redfish-core/include/redfish_aggregator.hpp b/redfish-core/include/redfish_aggregator.hpp
index 896eb4a..1c514ec 100644
--- a/redfish-core/include/redfish_aggregator.hpp
+++ b/redfish-core/include/redfish_aggregator.hpp
@@ -953,7 +953,7 @@
auto& satMembers = jsonVal["Members"];
for (auto& satMem : satMembers)
{
- members.push_back(std::move(satMem));
+ members.emplace_back(std::move(satMem));
}
asyncResp->res.jsonValue["Members@odata.count"] =
members.size();
diff --git a/redfish-core/include/utils/collection.hpp b/redfish-core/include/utils/collection.hpp
index f2f0669..05e4b4d 100644
--- a/redfish-core/include/utils/collection.hpp
+++ b/redfish-core/include/utils/collection.hpp
@@ -80,7 +80,7 @@
crow::utility::appendUrlPieces(url, leaf);
nlohmann::json::object_t member;
member["@odata.id"] = std::move(url);
- members.push_back(std::move(member));
+ members.emplace_back(std::move(member));
}
aResp->res.jsonValue["Members@odata.count"] = members.size();
});
diff --git a/redfish-core/include/utils/sw_utils.hpp b/redfish-core/include/utils/sw_utils.hpp
index 7c746a0..28cb41b 100644
--- a/redfish-core/include/utils/sw_utils.hpp
+++ b/redfish-core/include/utils/sw_utils.hpp
@@ -199,7 +199,7 @@
member["@odata.id"] = crow::utility::urlFromPieces(
"redfish", "v1", "UpdateService",
"FirmwareInventory", swId);
- softwareImageMembers.push_back(std::move(member));
+ softwareImageMembers.emplace_back(std::move(member));
aResp->res
.jsonValue["Links"]["SoftwareImages@odata.count"] =
softwareImageMembers.size();