summaryrefslogtreecommitdiff
path: root/include/openbmc_dbus_rest.hpp
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2023-02-16 21:37:01 +0300
committerEd Tanous <ed@tanous.net>2023-02-24 20:21:40 +0300
commit5e7e2dc585dc7a7e62d2b648b541e7f50c39ea5d (patch)
treeee3993e0fb2dc6e244a5fc31c7e83b26783161ee /include/openbmc_dbus_rest.hpp
parent26ccae32112679c4653c1e3f8a1203c828bea05c (diff)
downloadbmcweb-5e7e2dc585dc7a7e62d2b648b541e7f50c39ea5d.tar.xz
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
Diffstat (limited to 'include/openbmc_dbus_rest.hpp')
-rw-r--r--include/openbmc_dbus_rest.hpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index 30351051dd..98dfb843fa 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -131,7 +131,7 @@ inline void
crow::connections::systemBus->async_method_call(
[transaction, processName{std::string(processName)},
objectPath{std::string(objectPath)}](
- const boost::system::error_code ec,
+ const boost::system::error_code& ec,
const std::string& introspectXml) {
if (ec)
{
@@ -192,7 +192,7 @@ inline void getPropertiesForEnumerate(
sdbusplus::asio::getAllProperties(
*crow::connections::systemBus, service, objectPath, interface,
[asyncResp, objectPath, service,
- interface](const boost::system::error_code ec,
+ interface](const boost::system::error_code& ec,
const dbus::utility::DBusPropertiesMap& propertiesList) {
if (ec)
{
@@ -305,7 +305,7 @@ inline void getManagedObjectsForEnumerate(
<< " connection_name " << connectionName;
crow::connections::systemBus->async_method_call(
[transaction, objectName,
- connectionName](const boost::system::error_code ec,
+ connectionName](const boost::system::error_code& ec,
const dbus::utility::ManagedObjectType& objects) {
if (ec)
{
@@ -375,7 +375,7 @@ inline void findObjectManagerPathForEnumerate(
<< " on connection:" << connectionName;
crow::connections::systemBus->async_method_call(
[transaction, objectName, connectionName](
- const boost::system::error_code ec,
+ const boost::system::error_code& ec,
const dbus::utility::MapperGetAncestorsResponse& objects) {
if (ec)
{
@@ -1383,7 +1383,7 @@ inline void findActionOnInterface(
<< connectionName;
crow::connections::systemBus->async_method_call(
[transaction, connectionName{std::string(connectionName)}](
- const boost::system::error_code ec,
+ const boost::system::error_code& ec,
const std::string& introspectXml) {
BMCWEB_LOG_DEBUG << "got xml:\n " << introspectXml;
if (ec)
@@ -1495,7 +1495,7 @@ inline void findActionOnInterface(
crow::connections::systemBus->async_send(
m,
[transaction,
- returnType](boost::system::error_code ec2,
+ returnType](const boost::system::error_code& ec2,
sdbusplus::message_t& m2) {
if (ec2)
{
@@ -1747,7 +1747,7 @@ inline void handleGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
m.append(interface);
crow::connections::systemBus->async_send(
m, [asyncResp, response,
- propertyName](const boost::system::error_code ec2,
+ propertyName](const boost::system::error_code& ec2,
sdbusplus::message_t& msg) {
if (ec2)
{
@@ -1900,7 +1900,7 @@ inline void handlePut(const crow::Request& req,
crow::connections::systemBus->async_method_call(
[connectionName{std::string(connectionName)},
- transaction](const boost::system::error_code ec3,
+ transaction](const boost::system::error_code& ec3,
const std::string& introspectXml) {
if (ec3)
{
@@ -1984,8 +1984,9 @@ inline void handlePut(const crow::Request& req,
}
crow::connections::systemBus->async_send(
m,
- [transaction](boost::system::error_code ec,
- sdbusplus::message_t& m2) {
+ [transaction](
+ const boost::system::error_code& ec,
+ sdbusplus::message_t& m2) {
BMCWEB_LOG_DEBUG << "sent";
if (ec)
{
@@ -2157,7 +2158,7 @@ inline void
{
crow::connections::systemBus->async_method_call(
[asyncResp, processName,
- objectPath](const boost::system::error_code ec,
+ objectPath](const boost::system::error_code& ec,
const std::string& introspectXml) {
if (ec)
{
@@ -2212,7 +2213,7 @@ inline void
{
crow::connections::systemBus->async_method_call(
[asyncResp, processName, objectPath,
- interfaceName](const boost::system::error_code ec,
+ interfaceName](const boost::system::error_code& ec,
const std::string& introspectXml) {
if (ec)
{
@@ -2445,7 +2446,7 @@ inline void requestRoutes(App& app)
.methods(boost::beast::http::verb::get)(
[](const crow::Request&,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
- auto myCallback = [asyncResp](const boost::system::error_code ec,
+ auto myCallback = [asyncResp](const boost::system::error_code& ec,
std::vector<std::string>& names) {
if (ec)
{