Problem: assignment within complex condition

Solution: restructured code, inverted condition
This commit is contained in:
Simon Giesecke 2018-05-17 17:11:11 +02:00
parent fcee4ccdfd
commit 62e48f837d

View File

@ -1176,17 +1176,19 @@ void *zmq_poller_new (void)
int zmq_poller_destroy (void **poller_p_)
{
void *poller;
if (!poller_p_ || !(poller = *poller_p_)
|| !((zmq::socket_poller_t *) poller)->check_tag ()) {
if (poller_p_) {
zmq::socket_poller_t *const poller =
static_cast<zmq::socket_poller_t *> (*poller_p_);
if (poller && poller->check_tag ()) {
delete poller;
*poller_p_ = NULL;
return 0;
}
}
errno = EFAULT;
return -1;
}
delete ((zmq::socket_poller_t *) poller);
*poller_p_ = NULL;
return 0;
}
static int check_poller (void *const poller_)
{