event/poll: eliminate one vector::size() call

This commit is contained in:
Max Kellermann 2014-01-04 19:09:59 +01:00
parent c9da3363a0
commit 880bf17dae

View File

@ -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;