Skip to content

Commit f261347

Browse files
committed
client/barrier: use empty() instead of size()==0
For some containers, `empty()` is faster than `size()`. Signed-off-by: Max Kellermann <[email protected]>
1 parent 3ee1ce7 commit f261347

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/client/barrier.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ void BarrierContext::commit_barrier(barrier_interval &civ)
119119
std::unique_lock locker(lock);
120120

121121
/* we commit outstanding writes--if none exist, we don't care */
122-
if (outstanding_writes.size() == 0)
122+
if (outstanding_writes.empty())
123123
return;
124124

125125
boost::icl::interval_set<uint64_t> cvs;
@@ -174,7 +174,7 @@ void BarrierContext::complete(C_Block_Sync &cbs)
174174
/* signal waiters */
175175
barrier->cond.notify_all();
176176
/* dispose cleared barrier */
177-
if (barrier->write_list.size() == 0) {
177+
if (barrier->write_list.empty()) {
178178
BarrierList::iterator iter2 =
179179
BarrierList::s_iterator_to(*barrier);
180180
active_commits.erase(iter2);

0 commit comments

Comments
 (0)