]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
CInode.h: use !old_inodes.empty() instead of size()
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 13 Feb 2013 12:52:44 +0000 (13:52 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 13 Feb 2013 12:59:18 +0000 (13:59 +0100)
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 cppcheck was:
[src/mds/journal.cc:470]: (performance) Possible inefficient
  checking for 'old_inodes' emptiness.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/mds/CInode.h

index 4a6063275a93933abd6f42ab4b64cd2df9c99dec..32d27bcbe13e00931622859cb217e6cb28fd4f72 100644 (file)
@@ -190,7 +190,7 @@ public:
     return snaprealm ||  // other snaprealms will link to me
       inode.is_dir() ||  // links to me in other snaps
       inode.nlink > 1 || // there are remote links, possibly snapped, that will need to find me
-      old_inodes.size(); // once multiversion, always multiversion.  until old_inodes gets cleaned out.
+      !old_inodes.empty(); // once multiversion, always multiversion.  until old_inodes gets cleaned out.
   }
   snapid_t get_oldest_snap();