mirror of
https://github.com/zeromq/libzmq.git
synced 2025-02-22 15:07:28 +01:00
Merge pull request #3114 from sigiesec/fix-some-style-issues
Fix some code style issues
This commit is contained in:
commit
6a5051fac3
@ -72,7 +72,7 @@ struct blob_t
|
||||
blob_t () : data_ (0), size_ (0), owned_ (true) {}
|
||||
|
||||
// Creates a blob_t of a given size, with uninitialized content.
|
||||
blob_t (const size_t size) :
|
||||
explicit blob_t (const size_t size) :
|
||||
data_ ((unsigned char *) malloc (size)),
|
||||
size_ (size),
|
||||
owned_ (true)
|
||||
|
@ -57,6 +57,8 @@ void zmq::dealer_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
|
||||
|
||||
rc = pipe_->write (&probe_msg_);
|
||||
// zmq_assert (rc) is not applicable here, since it is not a bug.
|
||||
(void) rc;
|
||||
|
||||
pipe_->flush ();
|
||||
|
||||
rc = probe_msg_.close ();
|
||||
|
@ -108,17 +108,21 @@ void zmq::shared_message_memory_allocator::deallocate ()
|
||||
if (buf && !c->sub (1)) {
|
||||
std::free (buf);
|
||||
}
|
||||
release ();
|
||||
clear ();
|
||||
}
|
||||
|
||||
unsigned char *zmq::shared_message_memory_allocator::release ()
|
||||
{
|
||||
unsigned char *b = buf;
|
||||
clear ();
|
||||
return b;
|
||||
}
|
||||
|
||||
void zmq::shared_message_memory_allocator::clear ()
|
||||
{
|
||||
buf = NULL;
|
||||
bufsize = 0;
|
||||
msg_content = NULL;
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
void zmq::shared_message_memory_allocator::inc_ref ()
|
||||
|
@ -120,6 +120,8 @@ class shared_message_memory_allocator
|
||||
void advance_content () { msg_content++; }
|
||||
|
||||
private:
|
||||
void clear ();
|
||||
|
||||
unsigned char *buf;
|
||||
std::size_t bufsize;
|
||||
const std::size_t max_size;
|
||||
|
@ -36,7 +36,7 @@ zmq::mailbox_t::mailbox_t ()
|
||||
// Get the pipe into passive state. That way, if the users starts by
|
||||
// polling on the associated file descriptor it will get woken up when
|
||||
// new command is posted.
|
||||
const bool ok = cpipe.read (NULL);
|
||||
const bool ok = cpipe.check_read ();
|
||||
zmq_assert (!ok);
|
||||
active = false;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ zmq::mailbox_safe_t::mailbox_safe_t (mutex_t *sync_) : sync (sync_)
|
||||
// Get the pipe into passive state. That way, if the users starts by
|
||||
// polling on the associated file descriptor it will get woken up when
|
||||
// new command is posted.
|
||||
const bool ok = cpipe.read (NULL);
|
||||
const bool ok = cpipe.check_read ();
|
||||
zmq_assert (!ok);
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ int zmq::rep_t::xsend (msg_t *msg_)
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool more = msg_->flags () & msg_t::more ? true : false;
|
||||
bool more = (msg_->flags () & msg_t::more) != 0;
|
||||
|
||||
// Push message to the reply pipe.
|
||||
int rc = router_t::xsend (msg_);
|
||||
|
@ -126,7 +126,7 @@ int zmq::req_t::xsend (msg_t *msg_)
|
||||
}
|
||||
}
|
||||
|
||||
bool more = msg_->flags () & msg_t::more ? true : false;
|
||||
bool more = (msg_->flags () & msg_t::more) != 0;
|
||||
|
||||
int rc = dealer_t::xsend (msg_);
|
||||
if (rc != 0)
|
||||
@ -299,7 +299,8 @@ int zmq::req_session_t::push_msg (msg_t *msg_)
|
||||
if (msg_->size () == sizeof (uint32_t)) {
|
||||
state = request_id;
|
||||
return session_base_t::push_msg (msg_);
|
||||
} else if (msg_->size () == 0) {
|
||||
}
|
||||
if (msg_->size () == 0) {
|
||||
state = body;
|
||||
return session_base_t::push_msg (msg_);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user