From 5f305e51b5058b0101c76210b2d804a4a4867362 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 13 Dec 2021 12:01:35 +0100 Subject: [PATCH] QRingBuffer: simplify QRingChunk::clear() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clear should bring the QRingChunk into the default-constructe state, so just assign {} instead of calling assign(QByteArray()), which is equivalent, but has to manipulate QBA's atomic ref-count, which makes it unlikely the compiler will optimize this call. Pick-to: 6.3 Change-Id: Idab9c92ec84392d484395042db2427c668756efa Reviewed-by: MÃ¥rten Nordheim --- src/corelib/tools/qringbuffer_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h index bbab8df3e2d..65952f8ac7b 100644 --- a/src/corelib/tools/qringbuffer_p.h +++ b/src/corelib/tools/qringbuffer_p.h @@ -167,7 +167,7 @@ public: } inline void clear() { - assign(QByteArray()); + *this = {}; } private: