QtNetwork: replace clashing statics with lambdas II: isSeparator

Detected with -unity-build-batch-size 103.

Here, we just replace one of the static functions with a lambda,
because the transformed function was far away from the use site while
the unchanged instances (in qhsts.cpp) had several brethren isFoo()
functions and the use was close to the definition.

Pick-to: 6.6 6.5
Task-number: QTBUG-115031
Change-Id: Ib84a64cd8b9f20cad7806659990df76552c0c5e4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Marc Mutz 2023-07-04 14:40:10 +02:00
parent 5b7c8eb984
commit 586e07785c

View File

@ -37,12 +37,6 @@ using namespace QtMiscUtils;
class QNetworkProxy;
static inline bool isSeparator(char c)
{
static const char separators[] = "()<>@,;:\\\"/[]?={}";
return isLWS(c) || strchr(separators, c) != nullptr;
}
// ### merge with nextField in cookiejar.cpp
static QHash<QByteArray, QByteArray> parseHttpOptionHeader(const QByteArray &header)
{
@ -109,6 +103,11 @@ static QHash<QByteArray, QByteArray> parseHttpOptionHeader(const QByteArray &hea
++pos;
}
} else {
const auto isSeparator = [](char c) {
static const char separators[] = "()<>@,;:\\\"/[]?={}";
return isLWS(c) || strchr(separators, c) != nullptr;
};
// case: token
while (pos < header.size()) {
char c = header.at(pos);