]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
buffer: implement list::iterator::get_current_ptr()
authorSage Weil <sage@newdream.net>
Mon, 15 Nov 2010 04:21:05 +0000 (20:21 -0800)
committerSage Weil <sage@newdream.net>
Mon, 15 Nov 2010 04:21:05 +0000 (20:21 -0800)
Return a buffer::ptr for the ptr at the current position/offset, with the
length set to the remaining space in the current buffer.

Signed-off-by: Sage Weil <sage@newdream.net>
src/include/buffer.h

index a84dc62ab1239f9e22cdb8a31e6e1f71e89ded16..b886f317f0baed0c2a7e4a7779029e25e56d4c49 100644 (file)
@@ -622,6 +622,12 @@ public:
        return *this;
       }
 
+      ptr get_current_ptr() {
+       if (p == ls->end())
+         throw end_of_buffer();
+       return ptr(*p, p_off, p->length() - p_off);
+      }
+
       // copy data out.
       // note that these all _append_ to dest!