summaryrefslogtreecommitdiff
path: root/cpputil
diff options
context:
space:
mode:
authorMartin Thomson <mt@lowentropy.net>2022-01-05 13:45:04 +0000
committerMartin Thomson <mt@lowentropy.net>2022-01-05 13:45:04 +0000
commit0228311af67f0577b93710c0cdbc99b10a4cd882 (patch)
tree1b90cda0e8d89c424876b5898571dcec0e507618 /cpputil
parentc00e222c7159a73158f40a0233d669aea559d814 (diff)
downloadnss-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.h10
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_;