]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/MDCache.cc: use empty() instead of size() to check for emptiness
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 13 Feb 2013 16:57:54 +0000 (17:57 +0100)
committerGreg Farnum <greg@inktank.com>
Thu, 14 Feb 2013 18:27:39 +0000 (10:27 -0800)
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 <danny.al-gaaf@bisect.de>
src/mds/MDCache.cc

index da5ac0663ed914b88b83684402d13dba4ee84212..8762400ab55834742a8238ea16c952e324f42025 100644 (file)
@@ -5300,7 +5300,7 @@ void MDCache::queue_file_recover(CInode *in)
     predirty_journal_parents(mut, &le->metablob, in, 0, PREDIRTY_PRIMARY);
 
     s.erase(*s.begin());
-    while (s.size()) {
+    while (!s.empty()) {
       snapid_t snapid = *s.begin();
       CInode *cow_inode = 0;
       journal_cow_inode(mut, &le->metablob, in, snapid-1, &cow_inode);
@@ -7997,7 +7997,7 @@ void MDCache::anchor_create(MDRequest *mdr, CInode *in, Context *onfinish)
   // make trace
   vector<Anchor> trace;
   in->make_anchor_trace(trace);
-  if (!trace.size()) {
+  if (trace.empty()) {
     assert(MDS_INO_IS_BASE(in->ino()));
     trace.push_back(Anchor(in->ino(), in->ino(), 0, 0, 0));
   }