From 0f7de608ac0975bcfa12ff1be888c6b4f70d6d4a Mon Sep 17 00:00:00 2001 From: sangelovic Date: Fri, 11 Oct 2019 16:04:37 +0200 Subject: [PATCH] Little code cleanup --- src/Connection.cpp | 13 +++---------- src/Connection.h | 2 +- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/Connection.cpp b/src/Connection.cpp index 6679073..e1a25f2 100644 --- a/src/Connection.cpp +++ b/src/Connection.cpp @@ -110,16 +110,11 @@ void Connection::leaveProcessingLoop() sdbus::IConnection::PollData Connection::getProcessLoopPollData() { - sdbus::IConnection::PollData pollData; - ISdBus::PollData sdbusPollData; - auto r = iface_->sd_bus_get_poll_data(bus_.get(), &sdbusPollData); + ISdBus::PollData pollData; + auto r = iface_->sd_bus_get_poll_data(bus_.get(), &pollData); SDBUS_THROW_ERROR_IF(r < 0, "Failed to get bus poll data", -r); - pollData.fd = sdbusPollData.fd; - pollData.events = sdbusPollData.events; - pollData.timeout_usec = sdbusPollData.timeout_usec; - - return pollData; + return {pollData.fd, pollData.events, pollData.timeout_usec}; } const ISdBus& Connection::getSdBusInterface() const @@ -342,11 +337,9 @@ void Connection::joinWithProcessingLoop() bool Connection::processPendingRequest() { auto bus = bus_.get(); - assert(bus != nullptr); int r = iface_->sd_bus_process(bus, nullptr); - SDBUS_THROW_ERROR_IF(r < 0, "Failed to process bus requests", -r); return r > 0; diff --git a/src/Connection.h b/src/Connection.h index ee542ff..b8f8da4 100644 --- a/src/Connection.h +++ b/src/Connection.h @@ -57,8 +57,8 @@ namespace sdbus { namespace internal { void enterProcessingLoop() override; void enterProcessingLoopAsync() override; void leaveProcessingLoop() override; - bool processPendingRequest() override; sdbus::IConnection::PollData getProcessLoopPollData() override; + bool processPendingRequest() override; void addObjectManager(const std::string& objectPath) override; SlotPtr addObjectManager(const std::string& objectPath, void* /*dummy*/) override;