sdbusplus: Move callback instead of copy
We always want to instantiate these a single time, so we can move them.
In the future, the callback_t may chnage to a move only type so we can
support it this way.
Change-Id: I839298f43df108fd9d282fb4e4390e2d32ac3e78
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/sdbusplus.hpp b/src/sdbusplus.hpp
index 3767282..670caa0 100644
--- a/src/sdbusplus.hpp
+++ b/src/sdbusplus.hpp
@@ -90,9 +90,9 @@
/** @brief Register a DBus signal callback. */
static auto addMatch(const std::string& match,
- const sdbusplus::bus::match_t::callback_t& callback)
+ sdbusplus::bus::match_t::callback_t&& callback)
{
- getWatches().emplace_back(getBus(), match, callback);
+ getWatches().emplace_back(getBus(), match, std::move(callback));
}
/** @brief Look up the bus name for a path and interface */