diff options
| author | Rym Bouabid <rym.bouabid@qt.io> | 2024-08-13 12:42:01 +0200 |
|---|---|---|
| committer | Rym Bouabid <rym.bouabid@qt.io> | 2024-09-20 11:49:19 +0200 |
| commit | f0aa391ef89a393221d77d5ad3c1616a4727f11a (patch) | |
| tree | cf6b5a1b3d0a5644c1989ba0fc5ed26d093c0bd4 /src/testlib/qtestblacklist.cpp | |
| parent | 69e6ae1670faaa901e5ad06a79fa330761f1af36 (diff) | |
Use QIODevice::readLineInto() instead of readLine() in loops
Most of the callers of QIODevice::readLine() are reading a device line
by line in a loop. Instead, use one QByteArray and modify it in every
iteration using QIODevice::readLineInto().
Use a QByteArrayView instead of QByteArray when calling trimmed() as
it's an expensive operation.
Fixes: QTBUG-103108
Change-Id: Ic1af487a2fbf352cc21d76a41717944d034d3709
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/testlib/qtestblacklist.cpp')
| -rw-r--r-- | src/testlib/qtestblacklist.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/testlib/qtestblacklist.cpp b/src/testlib/qtestblacklist.cpp index 7d848b3f1c3..7567e467469 100644 --- a/src/testlib/qtestblacklist.cpp +++ b/src/testlib/qtestblacklist.cpp @@ -252,9 +252,9 @@ void parseBlackList() return; QByteArray function; + QByteArray line; - while (!ignored.atEnd()) { - QByteArray line = ignored.readLine(); + while (ignored.readLineInto(&line)) { const int commentPosition = line.indexOf('#'); if (commentPosition >= 0) line.truncate(commentPosition); |
