summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>2013-02-05 23:52:26 +0100
committerGary Lowell <glowell@inktank.com>2013-02-05 19:29:10 -0800
commit09bdfa40d59e76f6027518cf07bfc7e527545216 (patch)
tree2359850991ae28e4c1c27cc1d9136c47a1559949
parent25037fcc3509e5e1cba634cbcbf5b3718544779c (diff)
downloadceph-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.h10
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;
}