From 75cd9c13c2c6130d51ccacd7f1247bdc2628e4b3 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 24 Aug 2020 11:46:24 +0200 Subject: [PATCH] QRegularExpression: code tidies Given QList-is-QVector, remove an historical piece of code. Change-Id: I7a8876be8ade6dbaa1822d773b092ddb3c4182d4 Reviewed-by: Lars Knoll Reviewed-by: Thiago Macieira --- src/corelib/text/qregularexpression.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/corelib/text/qregularexpression.cpp b/src/corelib/text/qregularexpression.cpp index a0b35f8142..dc6c1987c9 100644 --- a/src/corelib/text/qregularexpression.cpp +++ b/src/corelib/text/qregularexpression.cpp @@ -1488,12 +1488,8 @@ QStringList QRegularExpression::namedCaptureGroups() const pcre2_pattern_info_16(d->compiledPattern, PCRE2_INFO_NAMECOUNT, &namedCapturingTableEntryCount); pcre2_pattern_info_16(d->compiledPattern, PCRE2_INFO_NAMEENTRYSIZE, &namedCapturingTableEntrySize); - QStringList result; - - // no QList::resize nor fill is available. The +1 is for the implicit group #0 - result.reserve(d->capturingCount + 1); - for (int i = 0; i < d->capturingCount + 1; ++i) - result.append(QString()); + // The +1 is for the implicit group #0 + QStringList result(d->capturingCount + 1); for (unsigned int i = 0; i < namedCapturingTableEntryCount; ++i) { const auto currentNamedCapturingTableRow =