Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
53fb1206
Commit
53fb1206
authored
Sep 28, 2016
by
Min RK
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
heap-allocate events in zmq_poller_poll
variable-size array allocation is not allowed by some compilers
parent
55930f5e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
zmq.cpp
src/zmq.cpp
+8
-2
No files found.
src/zmq.cpp
View file @
53fb1206
...
...
@@ -747,10 +747,12 @@ inline int zmq_poller_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
{
// implement zmq_poll on top of zmq_poller
int
rc
;
zmq_poller_event_t
events
[
nitems_
];
zmq_poller_event_t
*
events
;
events
=
new
zmq_poller_event_t
[
nitems_
];
alloc_assert
(
events
);
void
*
poller
=
zmq_poller_new
();
alloc_assert
(
poller
);
// Register sockets with poller
for
(
int
i
=
0
;
i
<
nitems_
;
i
++
)
{
if
(
items_
[
i
].
socket
)
{
...
...
@@ -758,6 +760,7 @@ inline int zmq_poller_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
rc
=
zmq_poller_add
(
poller
,
items_
[
i
].
socket
,
NULL
,
items_
[
i
].
events
);
if
(
rc
<
0
)
{
zmq_poller_destroy
(
&
poller
);
delete
[]
events
;
return
rc
;
}
}
else
{
...
...
@@ -765,6 +768,7 @@ inline int zmq_poller_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
rc
=
zmq_poller_add_fd
(
poller
,
items_
[
i
].
fd
,
NULL
,
items_
[
i
].
events
);
if
(
rc
<
0
)
{
zmq_poller_destroy
(
&
poller
);
delete
[]
events
;
return
rc
;
}
}
...
...
@@ -774,6 +778,7 @@ inline int zmq_poller_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
rc
=
zmq_poller_wait_all
(
poller
,
events
,
nitems_
,
timeout_
);
if
(
rc
<
0
)
{
zmq_poller_destroy
(
&
poller
);
delete
[]
events
;
return
rc
;
}
...
...
@@ -784,6 +789,7 @@ inline int zmq_poller_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
// Cleanup
rc
=
zmq_poller_destroy
(
&
poller
);
delete
[]
events
;
return
rc
;
}
#endif // ZMQ_HAVE_POLLER
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment