From bcd349d7c70d49b4085b3ca0da3c3b4797ffc647 Mon Sep 17 00:00:00 2001 From: sageweil Date: Thu, 26 Jul 2007 17:31:59 +0000 Subject: [PATCH] swap() in buffer::ptr and ::list git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1558 29311d96-e01e-0410-9327-a35deaab8ce9 --- trunk/ceph/include/buffer.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/trunk/ceph/include/buffer.h b/trunk/ceph/include/buffer.h index 5c96f0f006f..df5d58f4fbb 100644 --- a/trunk/ceph/include/buffer.h +++ b/trunk/ceph/include/buffer.h @@ -245,6 +245,18 @@ public: release(); } + void swap(ptr& other) { + raw *r = _raw; + unsigned o = _off; + unsigned l = _len; + _raw = other._raw; + _off = other._off; + _len = other._len; + other._raw = r; + other._off = o; + other._len = l; + } + void release() { if (_raw) { _raw->lock.Lock(); @@ -359,6 +371,14 @@ public: const std::list& buffers() const { return _buffers; } + void swap(list& other) { + unsigned t = _len; + _len = other._len; + other._len = t; + _buffers.swap(other._buffers); + append_buffer.swap(other.append_buffer); + } + unsigned length() const { #if 1 // DEBUG: verify _len