Skip to content

Commit 72545f1

Browse files
committed
refactor(urltools): Make regular expression static
domainHasIllegalCharacters() constructs a QRegularExpression on every call. Since the pattern is constant, make it static const QRegularExpression to avoid repeated regex compilation in hot paths (e.g., domain validation during browsing/passkey operations).
1 parent 682d6f1 commit 72545f1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/gui/UrlTools.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,6 @@ bool UrlTools::isUrlValid(const QString& urlField, bool looseComparison)
211211

212212
bool UrlTools::domainHasIllegalCharacters(const QString& domain)
213213
{
214-
const QRegularExpression re(R"([\s\^#|/:<>\?@\[\]\\])");
214+
static const QRegularExpression re(R"([\s\^#|/:<>\?@\[\]\\])");
215215
return re.match(domain).hasMatch();
216216
}

0 commit comments

Comments
 (0)