From ec750732d40fa3a0f9fef032c86788ac91361be8 Mon Sep 17 00:00:00 2001 From: Min RK Date: Tue, 27 Sep 2016 14:59:07 +0200 Subject: [PATCH] pass through poller events instead of allocating a new, identical array and copying the data. This is only safe while zmq_poller_event_t and zmq::socket_poller_t::event_t are the same struct, which they presumably will remain. --- src/zmq.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/zmq.cpp b/src/zmq.cpp index c791258d..8aaae035 100644 --- a/src/zmq.cpp +++ b/src/zmq.cpp @@ -1243,16 +1243,8 @@ int zmq_poller_wait_all (void *poller_, zmq_poller_event_t *events, int n_events } zmq_assert (events != NULL); - zmq::socket_poller_t::event_t evts[n_events]; - int rc = ((zmq::socket_poller_t*)poller_)->wait (evts, n_events, timeout_); - - for(int i = 0; i < n_events; ++i) { - events[i].socket = evts[i].socket; - events[i].fd = evts[i].fd; - events[i].user_data = evts[i].user_data; - events[i].events = evts[i].events; - } + int rc = ((zmq::socket_poller_t*)poller_)->wait ((zmq::socket_poller_t::event_t *)events, n_events, timeout_); return rc; }