aboutsummaryrefslogtreecommitdiffstats
path: root/src/event
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-04 19:09:59 +0100
committerMax Kellermann <max@duempel.org>2014-01-04 19:10:21 +0100
commit880bf17daee408cd927349b04a0273bd6a37d4cb (patch)
treec509e222aac783fbb78cacbf356f2b1f19c7b453 /src/event
parentc9da3363a04bfdf8a0f0b2d974291e422a0345d2 (diff)
downloadmpd-880bf17daee408cd927349b04a0273bd6a37d4cb.tar.gz
mpd-880bf17daee408cd927349b04a0273bd6a37d4cb.tar.xz
mpd-880bf17daee408cd927349b04a0273bd6a37d4cb.zip
event/poll: eliminate one vector::size() call
Diffstat (limited to 'src/event')
-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;