aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/diffeditor/diffutils.cpp
diff options
context:
space:
mode:
authorAlessandro Portale <alessandro.portale@qt.io>2024-11-20 12:19:18 +0100
committerAlessandro Portale <alessandro.portale@qt.io>2024-11-20 12:19:32 +0000
commit7c97a2b9f81adefc4fa03908e84865d77f5c4b5a (patch)
tree7add70dfe4542637c87c998b4aa827a0eb6ee1b5 /src/plugins/diffeditor/diffutils.cpp
parentd45193d12e947b5d9ecb558c820c05631e705686 (diff)
Plugins A-L: Make static QRegularExpression instances static const
Change-Id: I6de1ddd036b654472b0a8cc020dc1dbf1bc1d270 Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/diffeditor/diffutils.cpp')
-rw-r--r--src/plugins/diffeditor/diffutils.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/plugins/diffeditor/diffutils.cpp b/src/plugins/diffeditor/diffutils.cpp
index afb75203037..6a5c579a7c1 100644
--- a/src/plugins/diffeditor/diffutils.cpp
+++ b/src/plugins/diffeditor/diffutils.cpp
@@ -845,15 +845,15 @@ static FileData readDiffHeaderAndChunks(QStringView headerAndChunks, bool *ok)
FileData fileData;
bool readOk = false;
- const QRegularExpression leftFileRegExp(
+ static const QRegularExpression leftFileRegExp(
"(?:\\n|^)-{3} " // "--- "
"([^\\t\\n]+)" // "fileName1"
"(?:\\t[^\\n]*)*\\n"); // optionally followed by: \t anything \t anything ...)
- const QRegularExpression rightFileRegExp(
+ static const QRegularExpression rightFileRegExp(
"^\\+{3} " // "+++ "
"([^\\t\\n]+)" // "fileName2"
"(?:\\t[^\\n]*)*\\n"); // optionally followed by: \t anything \t anything ...)
- const QRegularExpression binaryRegExp(
+ static const QRegularExpression binaryRegExp(
"^Binary files ([^\\t\\n]+) and ([^\\t\\n]+) differ$");
// followed either by leftFileRegExp
@@ -895,7 +895,8 @@ static FileData readDiffHeaderAndChunks(QStringView headerAndChunks, bool *ok)
static void readDiffPatch(QPromise<QList<FileData>> &promise, QStringView patch)
{
- const QRegularExpression diffRegExp("(?:\\n|^)" // new line of the beginning of a patch
+ static const QRegularExpression diffRegExp(
+ "(?:\\n|^)" // new line of the beginning of a patch
"(" // either
"-{3} " // ---
"[^\\t\\n]+" // filename1
@@ -1282,7 +1283,7 @@ void DiffUtils::readPatchWithPromise(QPromise<QList<FileData>> &promise, const Q
promise.setProgressValue(0);
QStringView croppedPatch = QStringView(patch);
// Crop e.g. "-- \n2.10.2.windows.1\n\n" at end of file
- const QRegularExpression formatPatchEndingRegExp("(\\n-- \\n\\S*\\n\\n$)");
+ static const QRegularExpression formatPatchEndingRegExp("(\\n-- \\n\\S*\\n\\n$)");
const QRegularExpressionMatch match = formatPatchEndingRegExp.match(croppedPatch);
if (match.hasMatch())
croppedPatch = croppedPatch.left(match.capturedStart() + 1);