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.

Task-number: QTBUG-115031
Change-Id: Ib84a64cd8b9f20cad7806659990df76552c0c5e4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 586e07785ce276547d30502a8a44b212d37b95c7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2023-07-04 14:40:10 +02:00 committed by Qt Cherry-pick Bot
parent 95c8d2914a
commit ce7725cf85

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);