From: Danny Al-Gaaf Date: Wed, 13 Feb 2013 16:56:12 +0000 (+0100) Subject: mds/Locker.cc: use !empty() instead of size() X-Git-Tag: v0.58~66^2~22 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3ed962be8c916f68a70c976edd92dcdc265db33a;p=ceph.git mds/Locker.cc: use !empty() instead of size() 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(). Signed-off-by: Danny Al-Gaaf --- diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index d2ba41a4d76f..da6661889ef0 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -1575,7 +1575,7 @@ void Locker::file_update_finish(CInode *in, Mutation *mut, bool share, client_t mut->cleanup(); delete mut; - if (!in->is_head() && in->client_snap_caps.size()) { + if (!in->is_head() && !in->client_snap_caps.empty()) { dout(10) << " client_snap_caps " << in->client_snap_caps << dendl; // check for snap writeback completion bool gather = false; @@ -2357,7 +2357,7 @@ void Locker::handle_client_caps(MClientCaps *m) // We can infer that the client WONT send a FLUSHSNAP once they have // released all WR/EXCL caps (the FLUSHSNAP always comes before the cap // update/release). - if (head_in->client_need_snapflush.size()) { + if (!head_in->client_need_snapflush.empty()) { if ((cap->issued() & CEPH_CAP_ANY_FILE_WR) == 0) { _do_null_snapflush(head_in, client, follows); } else {