From a53dfe936a3690f03ff7a45691d09a6be42467ae Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Sat, 18 May 2019 16:08:10 +0100 Subject: [PATCH] Problem: many unnecessary ifdefs covering new xpub option Solution: remove them, only public headers have to be ifdef'd --- src/xpub.cpp | 17 ++--------------- src/xpub.hpp | 2 -- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/xpub.cpp b/src/xpub.cpp index 689d286a..131d3c90 100644 --- a/src/xpub.cpp +++ b/src/xpub.cpp @@ -44,9 +44,7 @@ zmq::xpub_t::xpub_t (class ctx_t *parent_, uint32_t tid_, int sid_) : _more (false), _lossy (true), _manual (false), -#ifdef ZMQ_BUILD_DRAFT_API _send_last_pipe (false), -#endif _pending_pipes (), _welcome_msg () { @@ -193,10 +191,8 @@ int zmq::xpub_t::xsetsockopt (int option_, size_t optvallen_) { if (option_ == ZMQ_XPUB_VERBOSE || option_ == ZMQ_XPUB_VERBOSER -#ifdef ZMQ_BUILD_DRAFT_API - || option_ == ZMQ_XPUB_MANUAL_LAST_VALUE -#endif - || option_ == ZMQ_XPUB_NODROP || option_ == ZMQ_XPUB_MANUAL) { + || option_ == ZMQ_XPUB_MANUAL_LAST_VALUE || option_ == ZMQ_XPUB_NODROP + || option_ == ZMQ_XPUB_MANUAL) { if (optvallen_ != sizeof (int) || *static_cast (optval_) < 0) { errno = EINVAL; @@ -208,11 +204,9 @@ int zmq::xpub_t::xsetsockopt (int option_, } else if (option_ == ZMQ_XPUB_VERBOSER) { _verbose_subs = (*static_cast (optval_) != 0); _verbose_unsubs = _verbose_subs; -#ifdef ZMQ_BUILD_DRAFT_API } else if (option_ == ZMQ_XPUB_MANUAL_LAST_VALUE) { _manual = (*static_cast (optval_) != 0); _send_last_pipe = _manual; -#endif } else if (option_ == ZMQ_XPUB_NODROP) _lossy = (*static_cast (optval_) == 0); else if (option_ == ZMQ_XPUB_MANUAL) @@ -276,13 +270,11 @@ void zmq::xpub_t::mark_as_matching (pipe_t *pipe_, xpub_t *self_) self_->_dist.match (pipe_); } -#ifdef ZMQ_BUILD_DRAFT_API void zmq::xpub_t::mark_last_pipe_as_matching (pipe_t *pipe_, xpub_t *self_) { if (self_->_last_pipe == pipe_) self_->_dist.match (pipe_); } -#endif int zmq::xpub_t::xsend (msg_t *msg_) { @@ -290,7 +282,6 @@ int zmq::xpub_t::xsend (msg_t *msg_) // For the first part of multi-part message, find the matching pipes. if (!_more) { -#ifdef ZMQ_BUILD_DRAFT_API if (_manual && _last_pipe && _send_last_pipe) { _subscriptions.match (static_cast (msg_->data ()), msg_->size (), mark_last_pipe_as_matching, @@ -299,10 +290,6 @@ int zmq::xpub_t::xsend (msg_t *msg_) } else _subscriptions.match (static_cast (msg_->data ()), msg_->size (), mark_as_matching, this); -#else - _subscriptions.match (static_cast (msg_->data ()), - msg_->size (), mark_as_matching, this); -#endif // If inverted matching is used, reverse the selection now if (options.invert_matching) { _dist.reverse_match (); diff --git a/src/xpub.hpp b/src/xpub.hpp index 21456faf..f8fa960f 100644 --- a/src/xpub.hpp +++ b/src/xpub.hpp @@ -99,13 +99,11 @@ class xpub_t : public socket_base_t // Subscriptions will not bed added automatically, only after calling set option with ZMQ_SUBSCRIBE or ZMQ_UNSUBSCRIBE bool _manual; -#ifdef ZMQ_BUILD_DRAFT_API // Send message to the last pipe, only used if xpub is on manual and after calling set option with ZMQ_SUBSCRIBE bool _send_last_pipe; // Function to be applied to match the last pipe. static void mark_last_pipe_as_matching (zmq::pipe_t *pipe_, xpub_t *arg_); -#endif // Last pipe that sent subscription message, only used if xpub is on manual pipe_t *_last_pipe;