Permalink
Browse files

Merge pull request #467 from hurtonm/code_cleanup

Code cleanup
  • Loading branch information...
2 parents 793895c + 66dc4d8 commit 99f714445f67d552eb2add6ed5f818d546dce901 @hintjens hintjens committed Nov 9, 2012
Showing with 71 additions and 98 deletions.
  1. +3 −6 src/dealer.cpp
  2. +2 −2 src/dealer.hpp
  3. +5 −8 src/dist.cpp
  4. +3 −3 src/dist.hpp
  5. +1 −4 src/lb.cpp
  6. +1 −1 src/lb.hpp
  7. +3 −6 src/pair.cpp
  8. +2 −2 src/pair.hpp
  9. +1 −1 src/pub.cpp
  10. +1 −1 src/pub.hpp
  11. +1 −4 src/pull.cpp
  12. +1 −1 src/pull.hpp
  13. +2 −2 src/push.cpp
  14. +1 −1 src/push.hpp
  15. +6 −6 src/rep.cpp
  16. +2 −2 src/rep.hpp
  17. +7 −7 src/req.cpp
  18. +2 −2 src/req.hpp
  19. +2 −8 src/router.cpp
  20. +2 −2 src/router.hpp
  21. +7 −7 src/socket_base.cpp
  22. +2 −2 src/socket_base.hpp
  23. +2 −2 src/sub.cpp
  24. +1 −1 src/sub.hpp
  25. +3 −6 src/xpub.cpp
  26. +2 −2 src/xpub.hpp
  27. +4 −7 src/xsub.cpp
  28. +2 −2 src/xsub.hpp
View
@@ -49,16 +49,13 @@ void zmq::dealer_t::xattach_pipe (pipe_t *pipe_, bool icanhasall_)
lb.attach (pipe_);
}
-int zmq::dealer_t::xsend (msg_t *msg_, int flags_)
+int zmq::dealer_t::xsend (msg_t *msg_)
{
- return lb.send (msg_, flags_);
+ return lb.send (msg_);
}
-int zmq::dealer_t::xrecv (msg_t *msg_, int flags_)
+int zmq::dealer_t::xrecv (msg_t *msg_)
{
- // flags_ is unused
- (void)flags_;
-
return fq.recv (msg_);
}
View
@@ -47,8 +47,8 @@ namespace zmq
// Overloads of functions from socket_base_t.
void xattach_pipe (zmq::pipe_t *pipe_, bool icanhasall_);
- int xsend (zmq::msg_t *msg_, int flags_);
- int xrecv (zmq::msg_t *msg_, int flags_);
+ int xsend (zmq::msg_t *msg_);
+ int xrecv (zmq::msg_t *msg_);
bool xhas_in ();
bool xhas_out ();
void xread_activated (zmq::pipe_t *pipe_);
View
@@ -103,19 +103,19 @@ void zmq::dist_t::activated (pipe_t *pipe_)
}
}
-int zmq::dist_t::send_to_all (msg_t *msg_, int flags_)
+int zmq::dist_t::send_to_all (msg_t *msg_)
{
matching = active;
- return send_to_matching (msg_, flags_);
+ return send_to_matching (msg_);
}
-int zmq::dist_t::send_to_matching (msg_t *msg_, int flags_)
+int zmq::dist_t::send_to_matching (msg_t *msg_)
{
// Is this end of a multipart message?
bool msg_more = msg_->flags () & msg_t::more ? true : false;
// Push the message to matching pipes.
- distribute (msg_, flags_);
+ distribute (msg_);
// If mutlipart message is fully sent, activate all the eligible pipes.
if (!msg_more)
@@ -126,11 +126,8 @@ int zmq::dist_t::send_to_matching (msg_t *msg_, int flags_)
return 0;
}
-void zmq::dist_t::distribute (msg_t *msg_, int flags_)
+void zmq::dist_t::distribute (msg_t *msg_)
{
- // flags_ is unused
- (void)flags_;
-
// If there are no matching pipes available, simply drop the message.
if (matching == 0) {
int rc = msg_->close ();
View
@@ -58,10 +58,10 @@ namespace zmq
void terminated (zmq::pipe_t *pipe_);
// Send the message to the matching outbound pipes.
- int send_to_matching (zmq::msg_t *msg_, int flags_);
+ int send_to_matching (zmq::msg_t *msg_);
// Send the message to all the outbound pipes.
- int send_to_all (zmq::msg_t *msg_, int flags_);
+ int send_to_all (zmq::msg_t *msg_);
bool has_out ();
@@ -72,7 +72,7 @@ namespace zmq
bool write (zmq::pipe_t *pipe_, zmq::msg_t *msg_);
// Put the message to all active pipes.
- void distribute (zmq::msg_t *msg_, int flags_);
+ void distribute (zmq::msg_t *msg_);
// List of outbound pipes.
typedef array_t <zmq::pipe_t, 2> pipes_t;
View
@@ -71,11 +71,8 @@ void zmq::lb_t::activated (pipe_t *pipe_)
active++;
}
-int zmq::lb_t::send (msg_t *msg_, int flags_)
+int zmq::lb_t::send (msg_t *msg_)
{
- // flags_ is unused
- (void)flags_;
-
// Drop the message if required. If we are at the end of the message
// switch back to non-dropping mode.
if (dropping) {
View
@@ -42,7 +42,7 @@ namespace zmq
void activated (pipe_t *pipe_);
void terminated (pipe_t *pipe_);
- int send (msg_t *msg_, int flags_);
+ int send (msg_t *msg_);
bool has_out ();
private:
View
@@ -69,14 +69,14 @@ void zmq::pair_t::xwrite_activated (pipe_t *)
// There's nothing to do here.
}
-int zmq::pair_t::xsend (msg_t *msg_, int flags_)
+int zmq::pair_t::xsend (msg_t *msg_)
{
if (!pipe || !pipe->write (msg_)) {
errno = EAGAIN;
return -1;
}
- if (!(flags_ & ZMQ_SNDMORE))
+ if (!(msg_->flags () & msg_t::more))
pipe->flush ();
// Detach the original message from the data buffer.
@@ -86,11 +86,8 @@ int zmq::pair_t::xsend (msg_t *msg_, int flags_)
return 0;
}
-int zmq::pair_t::xrecv (msg_t *msg_, int flags_)
+int zmq::pair_t::xrecv (msg_t *msg_)
{
- // flags_ is unused
- (void)flags_;
-
// Deallocate old content of the message.
int rc = msg_->close ();
errno_assert (rc == 0);
View
@@ -43,8 +43,8 @@ namespace zmq
// Overloads of functions from socket_base_t.
void xattach_pipe (zmq::pipe_t *pipe_, bool icanhasall_);
- int xsend (zmq::msg_t *msg_, int flags_);
- int xrecv (zmq::msg_t *msg_, int flags_);
+ int xsend (zmq::msg_t *msg_);
+ int xrecv (zmq::msg_t *msg_);
bool xhas_in ();
bool xhas_out ();
void xread_activated (zmq::pipe_t *pipe_);
View
@@ -32,7 +32,7 @@ zmq::pub_t::~pub_t ()
{
}
-int zmq::pub_t::xrecv (class msg_t *, int)
+int zmq::pub_t::xrecv (class msg_t *)
{
// Messages cannot be received from PUB socket.
errno = ENOTSUP;
View
@@ -40,7 +40,7 @@ namespace zmq
~pub_t ();
// Implementations of virtual functions from socket_base_t.
- int xrecv (zmq::msg_t *msg_, int flags_);
+ int xrecv (zmq::msg_t *msg_);
bool xhas_in ();
private:
View
@@ -53,11 +53,8 @@ void zmq::pull_t::xterminated (pipe_t *pipe_)
fq.terminated (pipe_);
}
-int zmq::pull_t::xrecv (msg_t *msg_, int flags_)
+int zmq::pull_t::xrecv (msg_t *msg_)
{
- // flags_ is unused
- (void)flags_;
-
return fq.recv (msg_);
}
View
@@ -46,7 +46,7 @@ namespace zmq
// Overloads of functions from socket_base_t.
void xattach_pipe (zmq::pipe_t *pipe_, bool icanhasall_);
- int xrecv (zmq::msg_t *msg_, int flags_);
+ int xrecv (zmq::msg_t *msg_);
bool xhas_in ();
void xread_activated (zmq::pipe_t *pipe_);
void xterminated (zmq::pipe_t *pipe_);
View
@@ -53,9 +53,9 @@ void zmq::push_t::xterminated (pipe_t *pipe_)
lb.terminated (pipe_);
}
-int zmq::push_t::xsend (msg_t *msg_, int flags_)
+int zmq::push_t::xsend (msg_t *msg_)
{
- return lb.send (msg_, flags_);
+ return lb.send (msg_);
}
bool zmq::push_t::xhas_out ()
View
@@ -46,7 +46,7 @@ namespace zmq
// Overloads of functions from socket_base_t.
void xattach_pipe (zmq::pipe_t *pipe_, bool icanhasall_);
- int xsend (zmq::msg_t *msg_, int flags_);
+ int xsend (zmq::msg_t *msg_);
bool xhas_out ();
void xwrite_activated (zmq::pipe_t *pipe_);
void xterminated (zmq::pipe_t *pipe_);
View
@@ -35,7 +35,7 @@ zmq::rep_t::~rep_t ()
{
}
-int zmq::rep_t::xsend (msg_t *msg_, int flags_)
+int zmq::rep_t::xsend (msg_t *msg_)
{
// If we are in the middle of receiving a request, we cannot send reply.
if (!sending_reply) {
@@ -46,7 +46,7 @@ int zmq::rep_t::xsend (msg_t *msg_, int flags_)
bool more = msg_->flags () & msg_t::more ? true : false;
// Push message to the reply pipe.
- int rc = router_t::xsend (msg_, flags_);
+ int rc = router_t::xsend (msg_);
if (rc != 0)
return rc;
@@ -57,7 +57,7 @@ int zmq::rep_t::xsend (msg_t *msg_, int flags_)
return 0;
}
-int zmq::rep_t::xrecv (msg_t *msg_, int flags_)
+int zmq::rep_t::xrecv (msg_t *msg_)
{
// If we are in middle of sending a reply, we cannot receive next request.
if (sending_reply) {
@@ -69,7 +69,7 @@ int zmq::rep_t::xrecv (msg_t *msg_, int flags_)
// to the reply pipe.
if (request_begins) {
while (true) {
- int rc = router_t::xrecv (msg_, flags_);
+ int rc = router_t::xrecv (msg_);
if (rc != 0)
return rc;
@@ -78,7 +78,7 @@ int zmq::rep_t::xrecv (msg_t *msg_, int flags_)
bool bottom = (msg_->size () == 0);
// Push it to the reply pipe.
- rc = router_t::xsend (msg_, flags_);
+ rc = router_t::xsend (msg_);
errno_assert (rc == 0);
if (bottom)
@@ -95,7 +95,7 @@ int zmq::rep_t::xrecv (msg_t *msg_, int flags_)
}
// Get next message part to return to the user.
- int rc = router_t::xrecv (msg_, flags_);
+ int rc = router_t::xrecv (msg_);
if (rc != 0)
return rc;
View
@@ -40,8 +40,8 @@ namespace zmq
~rep_t ();
// Overloads of functions from socket_base_t.
- int xsend (zmq::msg_t *msg_, int flags_);
- int xrecv (zmq::msg_t *msg_, int flags_);
+ int xsend (zmq::msg_t *msg_);
+ int xrecv (zmq::msg_t *msg_);
bool xhas_in ();
bool xhas_out ();
View
@@ -39,7 +39,7 @@ zmq::req_t::~req_t ()
{
}
-int zmq::req_t::xsend (msg_t *msg_, int flags_)
+int zmq::req_t::xsend (msg_t *msg_)
{
// If we've sent a request and we still haven't got the reply,
// we can't send another request.
@@ -54,15 +54,15 @@ int zmq::req_t::xsend (msg_t *msg_, int flags_)
int rc = bottom.init ();
errno_assert (rc == 0);
bottom.set_flags (msg_t::more);
- rc = dealer_t::xsend (&bottom, 0);
+ rc = dealer_t::xsend (&bottom);
if (rc != 0)
return -1;
message_begins = false;
}
bool more = msg_->flags () & msg_t::more ? true : false;
- int rc = dealer_t::xsend (msg_, flags_);
+ int rc = dealer_t::xsend (msg_);
if (rc != 0)
return rc;
@@ -75,7 +75,7 @@ int zmq::req_t::xsend (msg_t *msg_, int flags_)
return 0;
}
-int zmq::req_t::xrecv (msg_t *msg_, int flags_)
+int zmq::req_t::xrecv (msg_t *msg_)
{
// If request wasn't send, we can't wait for reply.
if (!receiving_reply) {
@@ -85,14 +85,14 @@ int zmq::req_t::xrecv (msg_t *msg_, int flags_)
// First part of the reply should be the original request ID.
if (message_begins) {
- int rc = dealer_t::xrecv (msg_, flags_);
+ int rc = dealer_t::xrecv (msg_);
if (rc != 0)
return rc;
// TODO: This should also close the connection with the peer!
if (unlikely (!(msg_->flags () & msg_t::more) || msg_->size () != 0)) {
while (true) {
- int rc = dealer_t::xrecv (msg_, flags_);
+ int rc = dealer_t::xrecv (msg_);
errno_assert (rc == 0);
if (!(msg_->flags () & msg_t::more))
break;
@@ -106,7 +106,7 @@ int zmq::req_t::xrecv (msg_t *msg_, int flags_)
message_begins = false;
}
- int rc = dealer_t::xrecv (msg_, flags_);
+ int rc = dealer_t::xrecv (msg_);
if (rc != 0)
return rc;
View
@@ -42,8 +42,8 @@ namespace zmq
~req_t ();
// Overloads of functions from socket_base_t.
- int xsend (zmq::msg_t *msg_, int flags_);
- int xrecv (zmq::msg_t *msg_, int flags_);
+ int xsend (zmq::msg_t *msg_);
+ int xrecv (zmq::msg_t *msg_);
bool xhas_in ();
bool xhas_out ();
View
@@ -140,11 +140,8 @@ void zmq::router_t::xwrite_activated (pipe_t *pipe_)
it->second.active = true;
}
-int zmq::router_t::xsend (msg_t *msg_, int flags_)
+int zmq::router_t::xsend (msg_t *msg_)
{
- // flags_ is unused
- (void)flags_;
-
// If this is the first part of the message it's the ID of the
// peer to send the message to.
if (!more_out) {
@@ -227,11 +224,8 @@ int zmq::router_t::xsend (msg_t *msg_, int flags_)
return 0;
}
-int zmq::router_t::xrecv (msg_t *msg_, int flags_)
+int zmq::router_t::xrecv (msg_t *msg_)
{
- // flags_ is unused
- (void)flags_;
-
if (prefetched) {
if (!identity_sent) {
int rc = msg_->move (prefetched_id);
View
@@ -50,8 +50,8 @@ namespace zmq
// Overloads of functions from socket_base_t.
void xattach_pipe (zmq::pipe_t *pipe_, bool icanhasall_);
int xsetsockopt (int option_, const void *optval_, size_t optvallen_);
- int xsend (msg_t *msg_, int flags_);
- int xrecv (msg_t *msg_, int flags_);
+ int xsend (msg_t *msg_);
+ int xrecv (msg_t *msg_);
bool xhas_in ();
bool xhas_out ();
void xread_activated (zmq::pipe_t *pipe_);
Oops, something went wrong.

0 comments on commit 99f7144

Please sign in to comment.