diff options
author | Patrick Williams <patrick@stwcx.xyz> | 2023-05-12 18:27:39 +0300 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2023-05-12 19:15:54 +0300 |
commit | b2ba30728fc644b206af43b3f807098b5fa470b6 (patch) | |
tree | 666c31daacab45762c400c51bbcd6c6eecf24a0e /include/openbmc_dbus_rest.hpp | |
parent | bc6cfec54c5c56e12e37e85db46d8b0d342090a9 (diff) | |
download | bmcweb-b2ba30728fc644b206af43b3f807098b5fa470b6.tar.xz |
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
Diffstat (limited to 'include/openbmc_dbus_rest.hpp')
-rw-r--r-- | include/openbmc_dbus_rest.hpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp index 82e3ecd8c1..51257642cb 100644 --- a/include/openbmc_dbus_rest.hpp +++ b/include/openbmc_dbus_rest.hpp @@ -144,7 +144,7 @@ inline void nlohmann::json::object_t object; object["path"] = objectPath; - transaction->res.jsonValue["objects"].push_back(std::move(object)); + transaction->res.jsonValue["objects"].emplace_back(std::move(object)); tinyxml2::XMLDocument doc; @@ -1356,7 +1356,7 @@ inline void handleMethodResponse( { for (auto& obj : data) { - transaction->methodResponse.push_back(std::move(obj)); + transaction->methodResponse.emplace_back(std::move(obj)); } return; } @@ -1366,13 +1366,13 @@ inline void handleMethodResponse( // They are different types. May as well turn them into an array nlohmann::json j = std::move(transaction->methodResponse); transaction->methodResponse = nlohmann::json::array(); - transaction->methodResponse.push_back(std::move(j)); - transaction->methodResponse.push_back(std::move(data)); + transaction->methodResponse.emplace_back(std::move(j)); + transaction->methodResponse.emplace_back(std::move(data)); transaction->convertedToArray = true; } else { - transaction->methodResponse.push_back(std::move(data)); + transaction->methodResponse.emplace_back(std::move(data)); } } @@ -2199,7 +2199,7 @@ inline void { nlohmann::json::object_t interfaceObj; interfaceObj["name"] = ifaceName; - interfacesArray.push_back(std::move(interfaceObj)); + interfacesArray.emplace_back(std::move(interfaceObj)); } interface = interface->NextSiblingElement("interface"); @@ -2291,7 +2291,7 @@ inline void thisArg[fieldName] = fieldValue; } } - argsArray.push_back(std::move(thisArg)); + argsArray.emplace_back(std::move(thisArg)); arg = arg->NextSiblingElement("arg"); } @@ -2314,7 +2314,7 @@ inline void object["uri"] = std::move(uri); object["args"] = argsArray; - methodsArray.push_back(std::move(object)); + methodsArray.emplace_back(std::move(object)); } methods = methods->NextSiblingElement("method"); } @@ -2344,7 +2344,7 @@ inline void nlohmann::json::object_t object; object["name"] = name; object["args"] = argsArray; - signalsArray.push_back(std::move(object)); + signalsArray.emplace_back(std::move(object)); } signals = signals->NextSiblingElement("signal"); @@ -2461,7 +2461,7 @@ inline void requestRoutes(App& app) { nlohmann::json::object_t object; object["name"] = name; - objectsSub.push_back(std::move(object)); + objectsSub.emplace_back(std::move(object)); } } }; |