diff options
author | Martin Thomson <mt@lowentropy.net> | 2022-01-05 13:45:04 +0000 |
---|---|---|
committer | Martin Thomson <mt@lowentropy.net> | 2022-01-05 13:45:04 +0000 |
commit | 0228311af67f0577b93710c0cdbc99b10a4cd882 (patch) | |
tree | 1b90cda0e8d89c424876b5898571dcec0e507618 /cpputil | |
parent | c00e222c7159a73158f40a0233d669aea559d814 (diff) | |
download | nss-hg-0228311af67f0577b93710c0cdbc99b10a4cd882.tar.gz |
Bug 1747310 - real move assignment operator, r=nss-reviewers,bbeurdouche
Differential Revision: https://phabricator.services.mozilla.com/D134818
Diffstat (limited to 'cpputil')
-rw-r--r-- | cpputil/databuffer.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/cpputil/databuffer.h b/cpputil/databuffer.h index d46944d4b..8d34e1a7d 100644 --- a/cpputil/databuffer.h +++ b/cpputil/databuffer.h @@ -32,7 +32,15 @@ class DataBuffer { } return *this; } - DataBuffer& operator=(DataBuffer&&) = default; + DataBuffer& operator=(DataBuffer&& other) { + if (this == &other) { + data_ = other.data_; + len_ = other.len_; + other.data_ = nullptr; + other.len_ = 0; + } + return *this; + } void Allocate(size_t l) { delete[] data_; |