From 6b8458d7a7de7ccd780b7dbf7bd1de13ef9ee726 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Wed, 13 Feb 2013 13:52:44 +0100 Subject: [PATCH] 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 --- src/mds/CInode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mds/CInode.h b/src/mds/CInode.h index 4a6063275a939..32d27bcbe13e0 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(); -- 2.39.5