QRingBuffer: improve skip() performance

Use free() instead of read(0, length) call.

Change-Id: I284e2099a3fb639cb40525ae2ca7fea0d09a620f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This commit is contained in:
Alex Trotsenko 2015-10-17 20:13:40 +03:00
parent bafbf3b872
commit 43b6101df3

View File

@ -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);