mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
Instantiate QRegularExpression instances statically
This commit is contained in:
@@ -542,9 +542,13 @@ void Launcher::processArguments() {
|
||||
}
|
||||
}
|
||||
|
||||
static const auto RegExp = QRegularExpression("[^a-z0-9\\-_]");
|
||||
gDebugMode = parseResult.contains("-debug");
|
||||
gKeyFile = parseResult.value("-key", {}).join(QString()).toLower();
|
||||
gKeyFile = gKeyFile.replace(QRegularExpression("[^a-z0-9\\-_]"), {});
|
||||
gKeyFile = parseResult
|
||||
.value("-key", {})
|
||||
.join(QString())
|
||||
.toLower()
|
||||
.replace(RegExp, {});
|
||||
gLaunchMode = parseResult.contains("-autostart") ? LaunchModeAutoStart
|
||||
: parseResult.contains("-fixprevious") ? LaunchModeFixPrevious
|
||||
: parseResult.contains("-cleanup") ? LaunchModeCleanup
|
||||
|
@@ -241,7 +241,7 @@ QString FindUpdateFile() {
|
||||
}
|
||||
const auto list = updates.entryInfoList(QDir::Files);
|
||||
for (const auto &info : list) {
|
||||
if (QRegularExpression(
|
||||
static const auto RegExp = QRegularExpression(
|
||||
"^("
|
||||
"tupdate|"
|
||||
"tx64upd|"
|
||||
@@ -250,7 +250,8 @@ QString FindUpdateFile() {
|
||||
"tlinuxupd|"
|
||||
")\\d+(_[a-z\\d]+)?$",
|
||||
QRegularExpression::CaseInsensitiveOption
|
||||
).match(info.fileName()).hasMatch()) {
|
||||
);
|
||||
if (RegExp.match(info.fileName()).hasMatch()) {
|
||||
return info.absoluteFilePath();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user