1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-22 20:44:15 +00:00

Initialize regex only once

This code path is commonly used so let it initialize only once.
This commit is contained in:
Chocobo1 2023-06-23 03:07:45 +08:00
parent 03d3552ee0
commit b3d2ba7d07
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C

View File

@ -189,7 +189,7 @@ bool RequestParser::parseRequestLine(const QString &line)
{ {
// [rfc7230] 3.1.1. Request Line // [rfc7230] 3.1.1. Request Line
const QRegularExpression re(u"^([A-Z]+)\\s+(\\S+)\\s+HTTP\\/(\\d\\.\\d)$"_s); static const QRegularExpression re(u"^([A-Z]+)\\s+(\\S+)\\s+HTTP\\/(\\d\\.\\d)$"_s);
const QRegularExpressionMatch match = re.match(line); const QRegularExpressionMatch match = re.match(line);
if (!match.hasMatch()) if (!match.hasMatch())