Lots of performance improvements
(In the voice of the kid from sixth sense) I see string copies...
Apparently there are a lot of places we make unnecessary copies. This
fixes all of them.
Not sure how to split this up into smaller patches, or if it even needs
split up. It seems pretty easy to review to me, because basically every
diff is identical.
Change-Id: I22b4ae4f96f7e4082d2bc701098a04f7bed95369
Signed-off-by: Ed Tanous <ed@tanous.net>
Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index 2da7f3a..3992c94 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -38,7 +38,7 @@
*
* @param[in] asyncResp - Shared pointer for completing asynchronous calls
*/
-inline void doBMCGracefulRestart(std::shared_ptr<AsyncResp> asyncResp)
+inline void doBMCGracefulRestart(const std::shared_ptr<AsyncResp>& asyncResp)
{
const char* processName = "xyz.openbmc_project.State.BMC";
const char* objectPath = "/xyz/openbmc_project/state/bmc0";
@@ -66,7 +66,7 @@
interfaceName, destProperty, dbusPropertyValue);
}
-inline void doBMCForceRestart(std::shared_ptr<AsyncResp> asyncResp)
+inline void doBMCForceRestart(const std::shared_ptr<AsyncResp>& asyncResp)
{
const char* processName = "xyz.openbmc_project.State.BMC";
const char* objectPath = "/xyz/openbmc_project/state/bmc0";
@@ -278,7 +278,7 @@
const std::string& path,
const std::string& currentProfile,
const std::vector<std::string>& supportedProfiles,
- std::shared_ptr<AsyncResp> asyncResp)
+ const std::shared_ptr<AsyncResp>& asyncResp)
{
crow::connections::systemBus->async_method_call(
@@ -763,7 +763,7 @@
inline CreatePIDRet createPidInterface(
const std::shared_ptr<AsyncResp>& response, const std::string& type,
- nlohmann::json::iterator it, const std::string& path,
+ const nlohmann::json::iterator& it, const std::string& path,
const dbus::utility::ManagedObjectType& managedObj, bool createNewObject,
boost::container::flat_map<std::string, dbus::utility::DbusVariantType>&
output,
@@ -1799,7 +1799,7 @@
pids->run();
getMainChassisId(asyncResp, [](const std::string& chassisId,
- const std::shared_ptr<AsyncResp> aRsp) {
+ const std::shared_ptr<AsyncResp>& aRsp) {
aRsp->res.jsonValue["Links"]["ManagerForChassis@odata.count"] = 1;
aRsp->res.jsonValue["Links"]["ManagerForChassis"] = {
{{"@odata.id", "/redfish/v1/Chassis/" + chassisId}}};
@@ -1910,7 +1910,7 @@
}
}
- void getLastResetTime(std::shared_ptr<AsyncResp> aResp)
+ void getLastResetTime(const std::shared_ptr<AsyncResp>& aResp)
{
BMCWEB_LOG_DEBUG << "Getting Manager Last Reset Time";
@@ -1953,7 +1953,7 @@
*
* @return void
*/
- void setActiveFirmwareImage(std::shared_ptr<AsyncResp> aResp,
+ void setActiveFirmwareImage(const std::shared_ptr<AsyncResp>& aResp,
const std::string&& runningFirmwareTarget)
{
// Get the Id from /redfish/v1/UpdateService/FirmwareInventory/<Id>