Problem: non consistent whitespace formatting

* Converted tabs to to 4 spaces to be consistend with the rest of the
code
* Stripped white spaces from the end of lines
This commit is contained in:
Pawel Kurdybacha
2018-04-13 17:35:41 +01:00
parent 25196e5bb8
commit 8353e8460f
2 changed files with 50 additions and 50 deletions

42
zmq.hpp
View File

@@ -32,7 +32,7 @@
#define ZMQ_DEPRECATED(msg) __declspec(deprecated(msg))
#elif defined(__GNUC__)
#define ZMQ_DEPRECATED(msg) __attribute__((deprecated(msg)))
#endif
#endif
#if (__cplusplus >= 201103L)
#define ZMQ_CPP11
@@ -1030,20 +1030,20 @@ namespace zmq
using handler_t = std::function<void(short)>;
ZMQ_DEPRECATED("from 4.3.0, use overload accepting handler_t instead")
ZMQ_DEPRECATED("from 4.3.0, use overload accepting handler_t instead")
void add (zmq::socket_t &socket, short events, std::function<void(void)> &handler)
{
add (socket, events, [&handler](short) { handler(); });
}
add (socket, events, [&handler](short) { handler(); });
}
void add (zmq::socket_t &socket, short events, handler_t handler)
{
handler_t *handler_ptr = nullptr;
/// \todo is it sensible to allow handler to be empty? doesn't this lead to an error when the event is signalled? (perhaps it should already lead to an error in zmq_poller_add then)
if (handler) {
auto emplace_res = handlers.emplace(&socket, std::move(handler));
handler_ptr = &emplace_res.first->second;
}
handler_t *handler_ptr = nullptr;
/// \todo is it sensible to allow handler to be empty? doesn't this lead to an error when the event is signalled? (perhaps it should already lead to an error in zmq_poller_add then)
if (handler) {
auto emplace_res = handlers.emplace(&socket, std::move(handler));
handler_ptr = &emplace_res.first->second;
}
if (0 == zmq_poller_add (poller_ptr, socket.ptr, handler_ptr, events)) {
poller_events.emplace_back (zmq_poller_event_t ());
return;
@@ -1054,11 +1054,11 @@ namespace zmq
void remove (zmq::socket_t &socket)
{
if (0 == zmq_poller_remove (poller_ptr, socket.ptr)) {
auto it = handlers.find (&socket);
if (it != handlers.end ()) { /// \todo this may only be false if handler was empty on add
handlers.erase (it);
}
poller_events.pop_back ();
auto it = handlers.find (&socket);
if (it != handlers.end ()) { /// \todo this may only be false if handler was empty on add
handlers.erase (it);
}
poller_events.pop_back ();
return;
}
throw error_t ();
@@ -1084,16 +1084,16 @@ namespace zmq
throw error_t ();
}
size_t size ()
{
return poller_events.size();
}
size_t size ()
{
return poller_events.size();
}
private:
void *poller_ptr;
std::vector<zmq_poller_event_t> poller_events;
std::map<socket_t*, handler_t> handlers;
std::map<socket_t*, handler_t> handlers;
}; // class poller_t
#endif // defined(ZMQ_BUILD_DRAFT_API) && defined(ZMQ_CPP11) && defined(ZMQ_HAVE_POLLER)