aboutsummaryrefslogtreecommitdiffstats
path: root/src/event/PollGroupPoll.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/event/PollGroupPoll.cxx')
-rw-r--r--src/event/PollGroupPoll.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/event/PollGroupPoll.cxx b/src/event/PollGroupPoll.cxx
index a2b4d1d88..89d09d995 100644
--- a/src/event/PollGroupPoll.cxx
+++ b/src/event/PollGroupPoll.cxx
@@ -31,8 +31,9 @@ PollGroupPoll::~PollGroupPoll() { }
bool PollGroupPoll::Add(int fd, unsigned events, void *obj)
{
assert(items.find(fd) == items.end());
- poll_events.resize(poll_events.size() + 1);
- size_t index = poll_events.size() - 1;
+
+ const size_t index = poll_events.size();
+ poll_events.resize(index + 1);
auto &e = poll_events[index];
e.fd = fd;
e.events = events;