]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test_object_map.cc: use empty() to check for emptiness
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 13 Feb 2013 17:58:41 +0000 (18:58 +0100)
committerGreg Farnum <greg@inktank.com>
Thu, 14 Feb 2013 18:27:40 +0000 (10:27 -0800)
Use !empty() instead of 'size()' to check for emptiness for
performance reasons.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/test/ObjectMap/test_object_map.cc

index e536be3b847369e1761fd31f6bf86882d6237d2c..e26b0e2c31cf595f49bab849e2f4b34e6f4d88cf 100644 (file)
@@ -125,7 +125,7 @@ public:
     to_get.insert(key);
     map<string, bufferlist> got;
     db->get_xattrs(hoid, to_get, &got);
-    if (got.size()) {
+    if (!got.empty()) {
       *value = string(got.begin()->second.c_str(),
                      got.begin()->second.length());
       return 1;
@@ -145,7 +145,7 @@ public:
     to_get.insert(key);
     map<string, bufferlist> got;
     db->get_values(hoid, to_get, &got);
-    if (got.size()) {
+    if (!got.empty()) {
       *value = string(got.begin()->second.c_str(),
                      got.begin()->second.length());
       return 1;