From: Danny Al-Gaaf Date: Wed, 6 Feb 2013 11:02:47 +0000 (+0100) Subject: include/buffer.h: fix operator= X-Git-Tag: v0.58~137^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0327cbaa2ab48b8da8aad181f55ce4e48fe3946c;p=ceph.git include/buffer.h: fix operator= Fix operator=: return "iterator&" instead of 'iterator'. Check if 'this' equals 'other' before set anything. Signed-off-by: Danny Al-Gaaf --- diff --git a/src/include/buffer.h b/src/include/buffer.h index 9a635bdb5d0f..4f87ed7453b8 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,10 @@ 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; + } return *this; }