Skip to content

Commit

Permalink
Merge pull request #859 from TobiSchluter/improvements/remove_poll_st…
Browse files Browse the repository at this point in the history
…atic_cast

Remove redundant static_cast<void*> in examples.
  • Loading branch information
sappo authored Jul 27, 2021
2 parents 768aecc + d4f2064 commit 55d417d
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion examples/C++/asyncsrv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class client_task {
client_socket_.connect("tcp://localhost:5570");

zmq::pollitem_t items[] = {
{ static_cast<void*>(client_socket_), 0, ZMQ_POLLIN, 0 } };
{ client_socket_, 0, ZMQ_POLLIN, 0 } };
int request_nbr = 0;
try {
while (true) {
Expand Down
6 changes: 3 additions & 3 deletions examples/C++/lbbroker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ int main(int argc, char *argv[])

// Initialize poll set
zmq::pollitem_t items[] = {
// Always poll for worker activity on backend
{ static_cast<void*>(backend), 0, ZMQ_POLLIN, 0 },
// Always poll for worker activity on backend
{ backend, 0, ZMQ_POLLIN, 0 },
// Poll front-end only if we have available workers
{ static_cast<void*>(frontend), 0, ZMQ_POLLIN, 0 }
{ frontend, 0, ZMQ_POLLIN, 0 }
};
if (worker_queue.size())
zmq::poll(&items[0], 2, -1);
Expand Down
2 changes: 1 addition & 1 deletion examples/C++/lpclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ int main () {
while (expect_reply) {
// Poll socket for a reply, with timeout
zmq::pollitem_t items[] = {
{ static_cast<void*>(*client), 0, ZMQ_POLLIN, 0 } };
{ *client, 0, ZMQ_POLLIN, 0 } };
zmq::poll (&items[0], 1, REQUEST_TIMEOUT);

// If we got a reply, process it
Expand Down
2 changes: 1 addition & 1 deletion examples/C++/mdbroker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ class broker {
int64_t heartbeat_at = now + HEARTBEAT_INTERVAL;
while (!s_interrupted) {
zmq::pollitem_t items [] = {
{ static_cast<void*>(*m_socket), 0, ZMQ_POLLIN, 0} };
{ *m_socket, 0, ZMQ_POLLIN, 0} };
int64_t timeout = heartbeat_at - now;
if (timeout < 0)
timeout = 0;
Expand Down
2 changes: 1 addition & 1 deletion examples/C++/mdcliapi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class mdcli {
while (!s_interrupted) {
// Poll socket for a reply, with timeout
zmq::pollitem_t items [] = {
{ static_cast<void*>(*m_client), 0, ZMQ_POLLIN, 0 } };
{ *m_client, 0, ZMQ_POLLIN, 0 } };
zmq::poll (items, 1, m_timeout);

// If we got a reply, process it
Expand Down
2 changes: 1 addition & 1 deletion examples/C++/mdcliapi2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class mdcli {
{
// Poll socket for a reply, with timeout
zmq::pollitem_t items[] = {
{ static_cast<void*>(*m_client), 0, ZMQ_POLLIN, 0 } };
{ *m_client, 0, ZMQ_POLLIN, 0 } };
zmq::poll (items, 1, m_timeout);

// If we got a reply, process it
Expand Down
2 changes: 1 addition & 1 deletion examples/C++/mdwrkapi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class mdwrk {

while (!s_interrupted) {
zmq::pollitem_t items[] = {
{ static_cast<void*>(*m_worker), 0, ZMQ_POLLIN, 0 } };
{ *m_worker, 0, ZMQ_POLLIN, 0 } };
zmq::poll (items, 1, m_heartbeat);

if (items[0].revents & ZMQ_POLLIN) {
Expand Down
4 changes: 2 additions & 2 deletions examples/C++/mspoller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ int main (int argc, char *argv[])

// Initialize poll set
zmq::pollitem_t items [] = {
{ static_cast<void*>(receiver), 0, ZMQ_POLLIN, 0 },
{ static_cast<void*>(subscriber), 0, ZMQ_POLLIN, 0 }
{ receiver, 0, ZMQ_POLLIN, 0 },
{ subscriber, 0, ZMQ_POLLIN, 0 }
};
// Process messages from both sockets
while (1) {
Expand Down
4 changes: 2 additions & 2 deletions examples/C++/ppqueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ int main (void)

while (1) {
zmq::pollitem_t items [] = {
{ static_cast<void*>(backend), 0, ZMQ_POLLIN, 0 },
{ static_cast<void*>(frontend), 0, ZMQ_POLLIN, 0 }
{ backend, 0, ZMQ_POLLIN, 0 },
{ frontend, 0, ZMQ_POLLIN, 0 }
};
// Poll frontend only if we have available workers
if (queue.size()) {
Expand Down
4 changes: 2 additions & 2 deletions examples/C++/rrbroker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ int main (int argc, char *argv[])

// Initialize poll set
zmq::pollitem_t items [] = {
{ static_cast<void*>(frontend), 0, ZMQ_POLLIN, 0 },
{ static_cast<void*>(backend), 0, ZMQ_POLLIN, 0 }
{ frontend, 0, ZMQ_POLLIN, 0 },
{ backend, 0, ZMQ_POLLIN, 0 }
};

// Switch messages between sockets
Expand Down
4 changes: 2 additions & 2 deletions examples/C++/spqueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ int main (void)

while (1) {
zmq::pollitem_t items [] = {
{ static_cast<void*>(backend), 0, ZMQ_POLLIN, 0 },
{ static_cast<void*>(frontend), 0, ZMQ_POLLIN, 0 }
{ backend, 0, ZMQ_POLLIN, 0 },
{ frontend, 0, ZMQ_POLLIN, 0 }
};
// Poll frontend only if we have available workers
if (worker_queue.size())
Expand Down
4 changes: 2 additions & 2 deletions examples/C++/taskwork2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ int main (int argc, char *argv[])

// Process messages from receiver and controller
zmq::pollitem_t items [] = {
{ static_cast<void*>(receiver), 0, ZMQ_POLLIN, 0 },
{ static_cast<void*>(controller), 0, ZMQ_POLLIN, 0 }
{ receiver, 0, ZMQ_POLLIN, 0 },
{ controller, 0, ZMQ_POLLIN, 0 }
};
// Process messages from both sockets
while (1) {
Expand Down
4 changes: 2 additions & 2 deletions examples/C++/tripping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ broker_task (void *args)

// Initialize poll set
zmq::pollitem_t items [] = {
{ static_cast<void*>(frontend), 0, ZMQ_POLLIN, 0 },
{ static_cast<void*>(backend), 0, ZMQ_POLLIN, 0 }
{ frontend, 0, ZMQ_POLLIN, 0 },
{ backend, 0, ZMQ_POLLIN, 0 }
};
while (1) {
zmq::poll (items, 2, -1);
Expand Down

0 comments on commit 55d417d

Please sign in to comment.