QString::replace: replace QList with QVLA
to reduce allocations Change-Id: Iacc34e3a8825ca6425e8716f2b5e7b5dde2a5df7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
48a44cdf65
commit
bd5d313197
|
|
@ -4610,7 +4610,7 @@ QString &QString::replace(const QRegularExpression &re, const QString &after)
|
|||
|
||||
// 1. build the backreferences list, holding where the backreferences
|
||||
// are in the replacement string
|
||||
QList<QStringCapture> backReferences;
|
||||
QVarLengthArray<QStringCapture> backReferences;
|
||||
const qsizetype al = after.size();
|
||||
const QChar *ac = after.unicode();
|
||||
|
||||
|
|
@ -4642,7 +4642,7 @@ QString &QString::replace(const QRegularExpression &re, const QString &after)
|
|||
|
||||
qsizetype newLength = 0; // length of the new string, with all the replacements
|
||||
qsizetype lastEnd = 0;
|
||||
QList<QStringView> chunks;
|
||||
QVarLengthArray<QStringView> chunks;
|
||||
const QStringView copyView{ copy }, afterView{ after };
|
||||
while (iterator.hasNext()) {
|
||||
QRegularExpressionMatch match = iterator.next();
|
||||
|
|
|
|||
Loading…
Reference in New Issue