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 <edward.welbourne@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Alex Trotsenko 2018-01-05 17:37:50 +02:00
parent c1aaa13939
commit 2d260eada8

View File

@ -120,7 +120,7 @@ void QRingBuffer::free(qint64 bytes)
// keep a single block around if it does not exceed // keep a single block around if it does not exceed
// the basic block size, to avoid repeated allocations // the basic block size, to avoid repeated allocations
// between uses of the buffer // between uses of the buffer
if (bufferSize <= bytes) { if (bufferSize == bytes) {
if (chunk.capacity() <= basicBlockSize && !chunk.isShared()) { if (chunk.capacity() <= basicBlockSize && !chunk.isShared()) {
chunk.reset(); chunk.reset();
bufferSize = 0; bufferSize = 0;