summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-09-26 18:38:58 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-09-26 18:38:58 +0000
commit4ada4ab6551d15432749b4b06d838194297f687d (patch)
treef583b018daae2b566ef39d08c4539693ec60c2d7 /vespalib
parent69655b7a638e3588b46cbed18d9a644d8b82d9ed (diff)
Replace the dangerous stealBuffer method with a static one that requires std::move to make destruction more visible.
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/vespa/vespalib/data/databuffer.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/vespalib/src/vespa/vespalib/data/databuffer.h b/vespalib/src/vespa/vespalib/data/databuffer.h
index a520ecd58bd..e1c21661716 100644
--- a/vespalib/src/vespa/vespalib/data/databuffer.h
+++ b/vespalib/src/vespa/vespalib/data/databuffer.h
@@ -40,6 +40,7 @@ private:
char *_freept;
Alloc _buffer;
+ Alloc stealBuffer();
public:
typedef std::unique_ptr<DataBuffer> UP;
DataBuffer(const DataBuffer &) = delete;
@@ -606,7 +607,9 @@ public:
**/
void swap(DataBuffer &other);
- Alloc stealBuffer();
+ static Alloc stealBuffer(DataBuffer buf) {
+ return buf.stealBuffer();
+ }
};
} // namespace vespalib