diff options
author | Alex Trotsenko <alex1973tr@gmail.com> | 2015-10-17 20:13:40 +0300 |
---|---|---|
committer | Alex Trotsenko <alex1973tr@gmail.com> | 2015-10-20 14:44:21 +0000 |
commit | 43b6101df39c04fc8bac0e335c28e4ebcc779df4 (patch) | |
tree | 8721a646d156cb48b21bc8a988fa20a0118a4a27 /src/corelib/tools/qringbuffer_p.h | |
parent | bafbf3b872103409370fbda43a2ce3ad153a33f4 (diff) |
QRingBuffer: improve skip() performance
Use free() instead of read(0, length) call.
Change-Id: I284e2099a3fb639cb40525ae2ca7fea0d09a620f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'src/corelib/tools/qringbuffer_p.h')
-rw-r--r-- | src/corelib/tools/qringbuffer_p.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h index 3a5ae1c4cc..96c4f9acb6 100644 --- a/src/corelib/tools/qringbuffer_p.h +++ b/src/corelib/tools/qringbuffer_p.h @@ -119,7 +119,10 @@ public: Q_CORE_EXPORT void append(const QByteArray &qba); inline qint64 skip(qint64 length) { - return read(0, length); + qint64 bytesToSkip = qMin(length, bufferSize); + + free(bytesToSkip); + return bytesToSkip; } Q_CORE_EXPORT qint64 readLine(char *data, qint64 maxLength); |