event/poll: eliminate one vector::size() call
This commit is contained in:
parent
c9da3363a0
commit
880bf17dae
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user