QNetworkProxyFactory: don't re-call QUrl::scheme() in if-else chain.
... Just cache it. Change-Id: Iae70e09233b237d904ab100f46f8dc7ab9ac8e04 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
e5cd556cd1
commit
74a7454b37
@ -121,14 +121,15 @@ QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro
|
|||||||
bool haveDirectConnection = false;
|
bool haveDirectConnection = false;
|
||||||
foreach (const QUrl& url, rawProxies) {
|
foreach (const QUrl& url, rawProxies) {
|
||||||
QNetworkProxy::ProxyType type;
|
QNetworkProxy::ProxyType type;
|
||||||
if (url.scheme() == QLatin1String("http")) {
|
const QString scheme = url.scheme();
|
||||||
|
if (scheme == QLatin1String("http")) {
|
||||||
type = QNetworkProxy::HttpProxy;
|
type = QNetworkProxy::HttpProxy;
|
||||||
} else if (url.scheme() == QLatin1String("socks")
|
} else if (scheme == QLatin1String("socks")
|
||||||
|| url.scheme() == QLatin1String("socks5")) {
|
|| scheme == QLatin1String("socks5")) {
|
||||||
type = QNetworkProxy::Socks5Proxy;
|
type = QNetworkProxy::Socks5Proxy;
|
||||||
} else if (url.scheme() == QLatin1String("ftp")) {
|
} else if (scheme == QLatin1String("ftp")) {
|
||||||
type = QNetworkProxy::FtpCachingProxy;
|
type = QNetworkProxy::FtpCachingProxy;
|
||||||
} else if (url.scheme() == QLatin1String("direct")) {
|
} else if (scheme == QLatin1String("direct")) {
|
||||||
type = QNetworkProxy::NoProxy;
|
type = QNetworkProxy::NoProxy;
|
||||||
haveDirectConnection = true;
|
haveDirectConnection = true;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user