OSDN Git Service

optimize QRegExp::escape() for case that string will not need escaping
authorIvailo Monev <xakepa10@laimg.moc>
Fri, 13 Dec 2019 15:34:20 +0000 (15:34 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Fri, 13 Dec 2019 15:34:20 +0000 (15:34 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
src/core/tools/qregexp.cpp

index df3c547..8bb409c 100644 (file)
@@ -4093,7 +4093,7 @@ QString QRegExp::escape(const QString &str)
 {
     QString quoted;
     const int count = str.count();
-    quoted.reserve(count * 2);
+    quoted.reserve(count);
     const QLatin1Char backslash('\\');
     for (int i = 0; i < count; i++) {
         const QChar c = str.at(i);