]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
include/interval_set: use map::rbegin() for accessing the last element 38663/head
authorKefu Chai <kchai@redhat.com>
Mon, 21 Dec 2020 04:34:37 +0000 (12:34 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 21 Dec 2020 04:34:51 +0000 (12:34 +0800)
better than

p = end();
p--;

more concise this way.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/include/interval_set.h

index 2b6ba05d709c6c96001b4ee2e4a264e302f935dc..3ade9acae1171d814c544e9a7066e853f7ae00a7 100644 (file)
@@ -430,9 +430,8 @@ class interval_set {
   }
   offset_type range_end() const {
     ceph_assert(!empty());
-    auto p = m.end();
-    p--;
-    return p->first+p->second;
+    auto p = m.rbegin();
+    return p->first + p->second;
   }
 
   // interval start after p (where p not in set)