From 2d260eada8608e727b6bdb567da74c08b07b004f Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Fri, 5 Jan 2018 17:37:50 +0200 Subject: [PATCH] Micro-optimize QRingBuffer::free() Change the condition to strong equal, as 'bytes' was checked against wrong value on the start of the function. Change-Id: I4ec4768b9fff3292af233417c4a5862d72d4eeac Reviewed-by: Edward Welbourne Reviewed-by: Oswald Buddenhagen --- src/corelib/tools/qringbuffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qringbuffer.cpp b/src/corelib/tools/qringbuffer.cpp index c9ef3bc69a..d1a4ce79cb 100644 --- a/src/corelib/tools/qringbuffer.cpp +++ b/src/corelib/tools/qringbuffer.cpp @@ -120,7 +120,7 @@ void QRingBuffer::free(qint64 bytes) // keep a single block around if it does not exceed // the basic block size, to avoid repeated allocations // between uses of the buffer - if (bufferSize <= bytes) { + if (bufferSize == bytes) { if (chunk.capacity() <= basicBlockSize && !chunk.isShared()) { chunk.reset(); bufferSize = 0;