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/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index e04eac6..93e8196 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -1134,7 +1134,7 @@
redundancy["Status"]["Health"] = health;
redundancy["Status"]["State"] = "Enabled";
- jResp.push_back(std::move(redundancy));
+ jResp.emplace_back(std::move(redundancy));
});
});
}
@@ -2386,7 +2386,7 @@
url.set_fragment((""_json_pointer / fieldName / "0")
.to_string());
power["@odata.id"] = std::move(url);
- tempArray.push_back(std::move(power));
+ tempArray.emplace_back(std::move(power));
}
sensorJson = &(tempArray.back());
}
@@ -2415,7 +2415,7 @@
"redfish", "v1", "Chassis",
sensorsAsyncResp->chassisId,
sensorsAsyncResp->chassisSubNode, sensorId);
- tempArray.push_back(std::move(member));
+ tempArray.emplace_back(std::move(member));
sensorJson = &(tempArray.back());
}
else
@@ -2428,7 +2428,7 @@
url.set_fragment(
(""_json_pointer / fieldName).to_string());
member["@odata.id"] = std::move(url);
- tempArray.push_back(std::move(member));
+ tempArray.emplace_back(std::move(member));
sensorJson = &(tempArray.back());
}
}
@@ -2796,7 +2796,7 @@
member["@odata.id"] = crow::utility::urlFromPieces(
"redfish", "v1", "Chassis", chassisId, chassisSubNode, id);
- entriesArray.push_back(std::move(member));
+ entriesArray.emplace_back(std::move(member));
}
asyncResp->res.jsonValue["Members@odata.count"] = entriesArray.size();