Take boost error_code by reference
By convention, we should be following boost here, and passing error_code
by reference, not by value. This makes our code consistent, and removes
the need for a copy in some cases.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Id42ea4a90b6685a84818b87d1506c11256b3b9ae
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index 9da1be0..01ec4e5 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -61,7 +61,7 @@
dbus::utility::DbusVariantType dbusPropertyValue(propertyValue);
crow::connections::systemBus->async_method_call(
- [asyncResp](const boost::system::error_code ec) {
+ [asyncResp](const boost::system::error_code& ec) {
// Use "Set" method to set the property value.
if (ec)
{
@@ -90,7 +90,7 @@
dbus::utility::DbusVariantType dbusPropertyValue(propertyValue);
crow::connections::systemBus->async_method_call(
- [asyncResp](const boost::system::error_code ec) {
+ [asyncResp](const boost::system::error_code& ec) {
// Use "Set" method to set the property value.
if (ec)
{
@@ -211,7 +211,7 @@
}
crow::connections::systemBus->async_method_call(
- [asyncResp](const boost::system::error_code ec) {
+ [asyncResp](const boost::system::error_code& ec) {
if (ec)
{
BMCWEB_LOG_DEBUG << "Failed to ResetToDefaults: " << ec;
@@ -291,7 +291,7 @@
crow::connections::systemBus->async_method_call(
[asyncResp, currentProfile, supportedProfiles](
- const boost::system::error_code ec,
+ const boost::system::error_code& ec,
const dbus::utility::ManagedObjectType& managedObj) {
if (ec)
{
@@ -809,7 +809,7 @@
BMCWEB_LOG_DEBUG << "del " << path << " " << iface << "\n";
// delete interface
crow::connections::systemBus->async_method_call(
- [response, path](const boost::system::error_code ec) {
+ [response, path](const boost::system::error_code& ec) {
if (ec)
{
BMCWEB_LOG_ERROR << "Error patching " << path << ": " << ec;
@@ -1236,7 +1236,7 @@
sdbusplus::asio::getAllProperties(
*crow::connections::systemBus, owner, path, thermalModeIface,
[path, owner,
- self](const boost::system::error_code ec2,
+ self](const boost::system::error_code& ec2,
const dbus::utility::DBusPropertiesMap& resp) {
if (ec2)
{
@@ -1396,7 +1396,7 @@
// todo(james): might make sense to do a mapper call here if this
// interface gets more traction
crow::connections::systemBus->async_method_call(
- [self](const boost::system::error_code ec,
+ [self](const boost::system::error_code& ec,
const dbus::utility::ManagedObjectType& mObj) {
if (ec)
{
@@ -1449,7 +1449,7 @@
const std::string& owner = subtree[0].second[0].first;
sdbusplus::asio::getAllProperties(
*crow::connections::systemBus, owner, path, thermalModeIface,
- [self, path, owner](const boost::system::error_code ec2,
+ [self, path, owner](const boost::system::error_code& ec2,
const dbus::utility::DBusPropertiesMap& r) {
if (ec2)
{
@@ -1503,7 +1503,7 @@
}
currentProfile = *profile;
crow::connections::systemBus->async_method_call(
- [response](const boost::system::error_code ec) {
+ [response](const boost::system::error_code& ec) {
if (ec)
{
BMCWEB_LOG_ERROR << "Error patching profile" << ec;
@@ -1637,7 +1637,7 @@
crow::connections::systemBus->async_method_call(
[response,
propertyName{std::string(property.first)}](
- const boost::system::error_code ec) {
+ const boost::system::error_code& ec) {
if (ec)
{
BMCWEB_LOG_ERROR << "Error patching "
@@ -1682,7 +1682,7 @@
}
crow::connections::systemBus->async_method_call(
- [response](const boost::system::error_code ec) {
+ [response](const boost::system::error_code& ec) {
if (ec)
{
BMCWEB_LOG_ERROR << "Error Adding Pid Object "
@@ -1740,7 +1740,7 @@
sdbusplus::asio::getProperty<std::string>(
*crow::connections::systemBus, connectionName, path,
"xyz.openbmc_project.Inventory.Decorator.LocationCode", "LocationCode",
- [aResp](const boost::system::error_code ec,
+ [aResp](const boost::system::error_code& ec,
const std::string& property) {
if (ec)
{
@@ -1764,7 +1764,7 @@
*crow::connections::systemBus, "xyz.openbmc_project.State.BMC",
"/xyz/openbmc_project/state/bmc0", "xyz.openbmc_project.State.BMC",
"LastRebootTime",
- [aResp](const boost::system::error_code ec,
+ [aResp](const boost::system::error_code& ec,
const uint64_t lastResetTime) {
if (ec)
{
@@ -1816,7 +1816,7 @@
// Make sure the image is valid before setting priority
crow::connections::systemBus->async_method_call(
[aResp, firmwareId,
- runningFirmwareTarget](const boost::system::error_code ec,
+ runningFirmwareTarget](const boost::system::error_code& ec,
dbus::utility::ManagedObjectType& subtree) {
if (ec)
{
@@ -1872,7 +1872,7 @@
// An addition could be a Redfish Setting like
// ActiveSoftwareImageApplyTime and support OnReset
crow::connections::systemBus->async_method_call(
- [aResp](const boost::system::error_code ec2) {
+ [aResp](const boost::system::error_code& ec2) {
if (ec2)
{
BMCWEB_LOG_DEBUG << "D-Bus response error setting.";
@@ -1907,7 +1907,7 @@
}
crow::connections::systemBus->async_method_call(
[aResp{std::move(aResp)},
- datetime{std::move(datetime)}](const boost::system::error_code ec) {
+ datetime{std::move(datetime)}](const boost::system::error_code& ec) {
if (ec)
{
BMCWEB_LOG_DEBUG << "Failed to set elapsed time. "
@@ -2074,7 +2074,7 @@
*crow::connections::systemBus, "org.freedesktop.systemd1",
"/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager",
"Progress",
- [asyncResp](const boost::system::error_code ec,
+ [asyncResp](const boost::system::error_code& ec,
const double& val) {
if (ec)
{
@@ -2135,7 +2135,7 @@
sdbusplus::asio::getAllProperties(
*crow::connections::systemBus, connectionName, path,
"xyz.openbmc_project.Inventory.Decorator.Asset",
- [asyncResp](const boost::system::error_code ec2,
+ [asyncResp](const boost::system::error_code& ec2,
const dbus::utility::DBusPropertiesMap&
propertiesList) {
if (ec2)