Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
warning from cppchecker was:
[src/client/Client.cc:3649]: (performance) Possible inefficient
checking for 'mds_sessions' emptiness.
[src/client/Client.cc:7489]: (performance) Possible inefficient
checking for 'osds' emptiness.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
}
// wait for sessions to close
- while (mds_sessions.size()) {
+ while (!mds_sessions.empty()) {
ldout(cct, 2) << "waiting for " << mds_sessions.size() << " mds sessions to close" << dendl;
mount_cond.Wait(client_lock);
}
pg_t pg = osdmap->object_locator_to_pg(extents[0].oid, extents[0].oloc);
vector<int> osds;
osdmap->pg_to_acting_osds(pg, osds);
- if (!osds.size())
+ if (osds.empty())
return -EINVAL;
for (unsigned i = 0; i < osds.size(); i++) {