]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/CDentry.h: use projected.empty() instead of projected.size()
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Tue, 12 Feb 2013 16:25:00 +0000 (17:25 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Fri, 15 Feb 2013 20:55:08 +0000 (21:55 +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 cppchecker was:
[src/mds/CDentry.h:234]: (performance) Possible inefficient
  checking for 'projected' emptiness.

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

index aa10bf97118e1911a9bb6681f22bff82b1cabf80..d07ef066acd0b0f256b097218f815e2561a4f024 100644 (file)
@@ -231,7 +231,7 @@ public:
   bool is_projected() { return projected.size(); }
 
   linkage_t *get_projected_linkage() {
-    if (projected.size())
+    if (!projected.empty())
       return &projected.back();
     return &linkage;
   }