From: Max Kellermann Date: Fri, 4 Oct 2024 09:55:32 +0000 (+0200) Subject: client/barrier: use empty() instead of size()==0 X-Git-Tag: v20.0.0~184^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f261347e9a8a98bb0273bb75e084956c033e7e67;p=ceph.git client/barrier: use empty() instead of size()==0 For some containers, `empty()` is faster than `size()`. Signed-off-by: Max Kellermann --- diff --git a/src/client/barrier.cc b/src/client/barrier.cc index dfdedaf58565..ff365665d537 100644 --- a/src/client/barrier.cc +++ b/src/client/barrier.cc @@ -119,7 +119,7 @@ void BarrierContext::commit_barrier(barrier_interval &civ) std::unique_lock locker(lock); /* we commit outstanding writes--if none exist, we don't care */ - if (outstanding_writes.size() == 0) + if (outstanding_writes.empty()) return; boost::icl::interval_set cvs; @@ -174,7 +174,7 @@ void BarrierContext::complete(C_Block_Sync &cbs) /* signal waiters */ barrier->cond.notify_all(); /* dispose cleared barrier */ - if (barrier->write_list.size() == 0) { + if (barrier->write_list.empty()) { BarrierList::iterator iter2 = BarrierList::s_iterator_to(*barrier); active_commits.erase(iter2);