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/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 8cdb7e0..64dc204 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -638,7 +638,7 @@
                        const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::internalError(asyncResp->res);
@@ -654,7 +654,7 @@
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::internalError(asyncResp->res);
@@ -684,7 +684,7 @@
                        const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
     auto createIpHandler =
-        [asyncResp, ifaceId, gateway](const boost::system::error_code ec) {
+        [asyncResp, ifaceId, gateway](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::internalError(asyncResp->res);
@@ -722,7 +722,7 @@
 {
     crow::connections::systemBus->async_method_call(
         [asyncResp, ifaceId, address, prefixLength,
-         gateway](const boost::system::error_code ec) {
+         gateway](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::internalError(asyncResp->res);
@@ -730,7 +730,8 @@
         }
 
         crow::connections::systemBus->async_method_call(
-            [asyncResp, ifaceId, gateway](const boost::system::error_code ec2) {
+            [asyncResp, ifaceId,
+             gateway](const boost::system::error_code& ec2) {
             if (ec2)
             {
                 messages::internalError(asyncResp->res);
@@ -762,7 +763,7 @@
                        const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::internalError(asyncResp->res);
@@ -792,13 +793,13 @@
 {
     crow::connections::systemBus->async_method_call(
         [asyncResp, ifaceId, address,
-         prefixLength](const boost::system::error_code ec) {
+         prefixLength](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::internalError(asyncResp->res);
         }
         crow::connections::systemBus->async_method_call(
-            [asyncResp](const boost::system::error_code ec2) {
+            [asyncResp](const boost::system::error_code& ec2) {
             if (ec2)
             {
                 messages::internalError(asyncResp->res);
@@ -829,7 +830,7 @@
                        const std::string& address,
                        const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
-    auto createIpHandler = [asyncResp](const boost::system::error_code ec) {
+    auto createIpHandler = [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::internalError(asyncResp->res);
@@ -860,7 +861,7 @@
     crow::connections::systemBus->async_method_call(
         [ethifaceId{std::string{ethifaceId}},
          callback{std::forward<CallbackFunc>(callback)}](
-            const boost::system::error_code errorCode,
+            const boost::system::error_code& errorCode,
             const dbus::utility::ManagedObjectType& resp) {
         EthernetInterfaceData ethData{};
         boost::container::flat_set<IPv4AddressData> ipv4Data;
@@ -910,7 +911,7 @@
 {
     crow::connections::systemBus->async_method_call(
         [callback{std::forward<CallbackFunc>(callback)}](
-            const boost::system::error_code errorCode,
+            const boost::system::error_code& errorCode,
             dbus::utility::ManagedObjectType& resp) {
         // Callback requires vector<string> to retrieve all available
         // ethernet interfaces
@@ -963,7 +964,7 @@
         return;
     }
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::internalError(asyncResp->res);
@@ -982,7 +983,7 @@
     sdbusplus::message::object_path objPath =
         "/xyz/openbmc_project/network/" + ifaceId;
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::internalError(asyncResp->res);
@@ -1001,7 +1002,7 @@
 {
     std::vector<std::string> vectorDomainname = {domainname};
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::internalError(asyncResp->res);
@@ -1082,7 +1083,7 @@
         "xyz.openbmc_project.Common.Error.NotAllowed";
 
     crow::connections::systemBus->async_method_call(
-        [asyncResp, macAddress](const boost::system::error_code ec,
+        [asyncResp, macAddress](const boost::system::error_code& ec,
                                 const sdbusplus::message_t& msg) {
         if (ec)
         {
@@ -1115,7 +1116,7 @@
 {
     const std::string dhcp = getDhcpEnabledEnumeration(v4Value, v6Value);
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
@@ -1136,7 +1137,7 @@
     const bool& value, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
@@ -1156,7 +1157,7 @@
 {
     BMCWEB_LOG_DEBUG << propertyName << " = " << value;
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
@@ -1490,7 +1491,7 @@
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
     crow::connections::systemBus->async_method_call(
-        [asyncResp](const boost::system::error_code ec) {
+        [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
             messages::internalError(asyncResp->res);
@@ -2109,7 +2110,7 @@
                 if (vlanEnable)
                 {
                     crow::connections::systemBus->async_method_call(
-                        [asyncResp](const boost::system::error_code ec) {
+                        [asyncResp](const boost::system::error_code& ec) {
                         if (ec)
                         {
                             messages::internalError(asyncResp->res);
@@ -2165,7 +2166,7 @@
             if (success && ethData.vlanId)
             {
                 auto callback =
-                    [asyncResp](const boost::system::error_code ec) {
+                    [asyncResp](const boost::system::error_code& ec) {
                     if (ec)
                     {
                         messages::internalError(asyncResp->res);
@@ -2281,7 +2282,7 @@
             return;
         }
 
-        auto callback = [asyncResp](const boost::system::error_code ec) {
+        auto callback = [asyncResp](const boost::system::error_code& ec) {
             if (ec)
             {
                 // TODO(ed) make more consistent error messages