Commit 62e48f83 authored by Simon Giesecke's avatar Simon Giesecke

Problem: assignment within complex condition

Solution: restructured code, inverted condition
parent fcee4ccd
...@@ -685,7 +685,7 @@ const char *zmq_msg_gets (const zmq_msg_t *msg_, const char *property_) ...@@ -685,7 +685,7 @@ const char *zmq_msg_gets (const zmq_msg_t *msg_, const char *property_)
} }
} }
// Polling. // Polling.
#if defined ZMQ_HAVE_POLLER #if defined ZMQ_HAVE_POLLER
inline int zmq_poller_poll (zmq_pollitem_t *items_, int nitems_, long timeout_) inline int zmq_poller_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
...@@ -1176,18 +1176,20 @@ void *zmq_poller_new (void) ...@@ -1176,18 +1176,20 @@ void *zmq_poller_new (void)
int zmq_poller_destroy (void **poller_p_) int zmq_poller_destroy (void **poller_p_)
{ {
void *poller; if (poller_p_) {
if (!poller_p_ || !(poller = *poller_p_) zmq::socket_poller_t *const poller =
|| !((zmq::socket_poller_t *) poller)->check_tag ()) { static_cast<zmq::socket_poller_t *> (*poller_p_);
errno = EFAULT; if (poller && poller->check_tag ()) {
return -1; delete poller;
*poller_p_ = NULL;
return 0;
}
} }
errno = EFAULT;
delete ((zmq::socket_poller_t *) poller); return -1;
*poller_p_ = NULL;
return 0;
} }
static int check_poller (void *const poller_) static int check_poller (void *const poller_)
{ {
if (!poller_ || !((zmq::socket_poller_t *) poller_)->check_tag ()) { if (!poller_ || !((zmq::socket_poller_t *) poller_)->check_tag ()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment