From: Danny Al-Gaaf Date: Wed, 13 Feb 2013 12:52:44 +0000 (+0100) Subject: CInode.h: use !old_inodes.empty() instead of size() X-Git-Tag: v0.58~66^2~58 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6b8458d7a7de7ccd780b7dbf7bd1de13ef9ee726;p=ceph.git CInode.h: use !old_inodes.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(). warning from cppcheck was: [src/mds/journal.cc:470]: (performance) Possible inefficient checking for 'old_inodes' emptiness. Signed-off-by: Danny Al-Gaaf --- diff --git a/src/mds/CInode.h b/src/mds/CInode.h index 4a6063275a9..32d27bcbe13 100644 --- a/src/mds/CInode.h +++ b/src/mds/CInode.h @@ -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();