summaryrefslogtreecommitdiffstats
path: root/src/network/access/qnetworkcookiejar.cpp
diff options
context:
space:
mode:
authorAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-03-01 14:12:31 +0300
committerAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-03-03 11:48:22 +0000
commit06e27b6ef9549b08e34f016375bcc44a901a9325 (patch)
tree248763c51edc21c3f9b336d7ed80ed2437f38aa9 /src/network/access/qnetworkcookiejar.cpp
parent1bd24e5b0c7c329e8e6b00e85d2d360abf5630c6 (diff)
QtNetwork: optimize if-else conditions.
De-duplicate calls by caching results. Reorder conditions: call cheap methods first. Change-Id: I27715b935247c6c21bd02f9cc40655d3f9371264 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/network/access/qnetworkcookiejar.cpp')
-rw-r--r--src/network/access/qnetworkcookiejar.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/network/access/qnetworkcookiejar.cpp b/src/network/access/qnetworkcookiejar.cpp
index 1ae49aeee9..412b8d859d 100644
--- a/src/network/access/qnetworkcookiejar.cpp
+++ b/src/network/access/qnetworkcookiejar.cpp
@@ -331,7 +331,8 @@ bool QNetworkCookieJar::deleteCookie(const QNetworkCookie &cookie)
bool QNetworkCookieJar::validateCookie(const QNetworkCookie &cookie, const QUrl &url) const
{
QString domain = cookie.domain();
- if (!(isParentDomain(domain, url.host()) || isParentDomain(url.host(), domain)))
+ const QString host = url.host();
+ if (!isParentDomain(domain, host) && !isParentDomain(host, domain))
return false; // not accepted
// the check for effective TLDs makes the "embedded dot" rule from RFC 2109 section 4.3.2