Make property overloads accept by const ref
In asio enabled daemons it's generally good practice to capture
error_code by const reference, such that if an inherited class is
presented on the interface, no copy needs to be made, and more
importantly the copy code isn't generated in the binary.
This doesn't effect any use. I believe bmcweb is the only user of
these, and this reduces the template instantiation time by a minor
amount to keep this consistent.
Change-Id: I53c7d42844400a846ef2832aaf5dbd0cc651a85f
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/include/sdbusplus/asio/property.hpp b/include/sdbusplus/asio/property.hpp
index d99bc39..a467631 100644
--- a/include/sdbusplus/asio/property.hpp
+++ b/include/sdbusplus/asio/property.hpp
@@ -12,14 +12,14 @@
sdbusplus::asio::connection& bus, const std::string& service,
const std::string& path, const std::string& interface,
std::function<void(
- const boost::system::error_code,
+ const boost::system::error_code&,
const std::vector<std::pair<std::string, VariantType>>&)>&& handler)
{
static_assert(std::is_same_v<VariantType, std::decay_t<VariantType>>);
bus.async_method_call(
[handler = std::move(handler)](
- const boost::system::error_code ec,
+ const boost::system::error_code& ec,
const std::vector<std::pair<std::string, VariantType>>&
data) mutable { handler(ec, data); },
service, path, "org.freedesktop.DBus.Properties", "GetAll", interface);
@@ -49,7 +49,7 @@
bus.async_method_call(
[handler = std::move(handler)](
- boost::system::error_code ec,
+ const boost::system::error_code& ec,
std::variant<std::monostate, PropertyType>& ret) mutable {
if (ec)
{