diff options
| author | Marc Mutz <marc.mutz@qt.io> | 2021-12-14 22:03:02 +0100 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2021-12-16 12:47:39 +0100 |
| commit | e381288146c89250655507e2bc1e8771dd9672bb (patch) | |
| tree | 9d5372280deeec2cda9bfeece50ad778b32267b7 /src/corelib/tools/qringbuffer.cpp | |
| parent | b01c05ef9be3993013b8ac4e958d922c4e11f7ba (diff) | |
QRingBuffer: restrict QRingChunk::toByteArray() calls to rvalue *this
It's only user, QRingBuffer::read(), calls it on an rvalue, so we
don't need the lvalue overload, and we can devil-may-care-like just
std::move(chunk) in the non-isShared() case.
Change-Id: I99c16862f5586125c6346ce5f969dc735de738b8
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/tools/qringbuffer.cpp')
| -rw-r--r-- | src/corelib/tools/qringbuffer.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/tools/qringbuffer.cpp b/src/corelib/tools/qringbuffer.cpp index f59dcc39c4d..f32673b9bd7 100644 --- a/src/corelib/tools/qringbuffer.cpp +++ b/src/corelib/tools/qringbuffer.cpp @@ -62,7 +62,7 @@ void QRingChunk::detach() tailOffset = chunkSize; } -QByteArray QRingChunk::toByteArray() +QByteArray QRingChunk::toByteArray() && { if (headOffset != 0 || tailOffset != chunk.size()) { if (isShared()) @@ -79,7 +79,7 @@ QByteArray QRingChunk::toByteArray() chunk.resize(tailOffset); } - return chunk; + return std::move(chunk); } /*! |
