slot: shorten slot type
Create an alias `sdbusplus::slot_t` to `sdbusplus::slot::slot`
to reduce duplication.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I0ac45f676f1e52f53b6ea3a5b487d0f183641e37
diff --git a/include/sdbusplus/bus/match.hpp b/include/sdbusplus/bus/match.hpp
index be391b2..5763e96 100644
--- a/include/sdbusplus/bus/match.hpp
+++ b/include/sdbusplus/bus/match.hpp
@@ -79,7 +79,7 @@
{}
private:
- slot::slot _slot;
+ slot_t _slot;
std::unique_ptr<callback_t> _callback = nullptr;
static int callCallback(sd_bus_message* m, void* context,
diff --git a/include/sdbusplus/message.hpp b/include/sdbusplus/message.hpp
index a3f95af..7bd84a8 100644
--- a/include/sdbusplus/message.hpp
+++ b/include/sdbusplus/message.hpp
@@ -414,7 +414,7 @@
* @return The slot handle that manages the lifetime of the call object.
*/
template <typename Cb>
- [[nodiscard]] slot::slot
+ [[nodiscard]] slot_t
call_async(Cb&& cb, std::optional<SdBusDuration> timeout = std::nullopt)
{
sd_bus_slot* slot;
@@ -427,7 +427,7 @@
{
throw exception::SdBusError(-r, "sd_bus_call_async");
}
- slot::slot ret(std::move(slot));
+ slot_t ret(std::move(slot));
if constexpr (std::is_pointer_v<CbT>)
{
_intf->sd_bus_slot_set_userdata(slot, reinterpret_cast<void*>(cb));
diff --git a/include/sdbusplus/server/interface.hpp b/include/sdbusplus/server/interface.hpp
index d840bd2..4e709ea 100644
--- a/include/sdbusplus/server/interface.hpp
+++ b/include/sdbusplus/server/interface.hpp
@@ -110,7 +110,7 @@
bus_t _bus;
std::string _path;
std::string _interf;
- slot::slot _slot;
+ slot_t _slot;
SdBusInterface* _intf;
bool _interface_added;
};
diff --git a/include/sdbusplus/server/manager.hpp b/include/sdbusplus/server/manager.hpp
index 2a71127..9241bd9 100644
--- a/include/sdbusplus/server/manager.hpp
+++ b/include/sdbusplus/server/manager.hpp
@@ -41,7 +41,7 @@
* @param[in] bus - The bus to register on.
* @param[in] path - The path to register.
*/
- manager(sdbusplus::bus_t& bus, const char* path) : _slot(nullptr)
+ manager(sdbusplus::bus_t& bus, const char* path)
{
sd_bus_slot* slot = nullptr;
sdbusplus::SdBusInterface* intf = bus.getInterface();
@@ -52,7 +52,7 @@
}
private:
- slot::slot _slot;
+ slot_t _slot{nullptr};
};
} // namespace manager
diff --git a/include/sdbusplus/slot.hpp b/include/sdbusplus/slot.hpp
index 27f4a70..5fa9141 100644
--- a/include/sdbusplus/slot.hpp
+++ b/include/sdbusplus/slot.hpp
@@ -73,4 +73,7 @@
};
} // namespace slot
+
+using slot_t = slot::slot;
+
} // namespace sdbusplus