diff options
author | Danny Al-Gaaf <danny.al-gaaf@bisect.de> | 2013-02-05 23:52:26 +0100 |
---|---|---|
committer | Gary Lowell <glowell@inktank.com> | 2013-02-05 19:29:10 -0800 |
commit | 09bdfa40d59e76f6027518cf07bfc7e527545216 (patch) | |
tree | 2359850991ae28e4c1c27cc1d9136c47a1559949 | |
parent | 25037fcc3509e5e1cba634cbcbf5b3718544779c (diff) | |
download | ceph-09bdfa40d59e76f6027518cf07bfc7e527545216.tar.gz |
include/buffer.h: fix operator=
Fix operator=: return "iterator&" instead of 'iterator'. Also set last_p and
other.append_buffer and check if 'this' equals 'other' before set anything.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
-rw-r--r-- | src/include/buffer.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/include/buffer.h b/src/include/buffer.h index 9a635bdb5d0..448d947e911 100644 --- a/src/include/buffer.h +++ b/src/include/buffer.h @@ -248,7 +248,7 @@ public: p(other.p), p_off(other.p_off) {} - iterator operator=(const iterator& other) { + iterator& operator=(const iterator& other) { if (this != &other) { bl = other.bl; ls = other.ls; @@ -305,8 +305,12 @@ public: list(const list& other) : _buffers(other._buffers), _len(other._len), last_p(this) { } list& operator= (const list& other) { - _buffers = other._buffers; - _len = other._len; + if (this != &other) { + _buffers = other._buffers; + _len = other._len; + last_p = other.last_p; + append_buffer = other.append_buffer; + } return *this; } |