summaryrefslogtreecommitdiffstats
path: root/src/network/access
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2021-08-31 16:20:09 +0200
committerMårten Nordheim <marten.nordheim@qt.io>2021-09-02 16:57:42 +0200
commit05c9894330d39cefd6ab611799fb9a3e16f17aeb (patch)
tree9be9bd69bfeac07154dd8367f28e66a8217a3f33 /src/network/access
parenta253bec500a837496d19438f76cfa06b704f2a57 (diff)
QNetworkAccessCache: Style fixes and move asserts
Change-Id: I300d2525d9987737697e2cc6a326be19554902c8 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/network/access')
-rw-r--r--src/network/access/qnetworkaccesscache.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/network/access/qnetworkaccesscache.cpp b/src/network/access/qnetworkaccesscache.cpp
index 9e5d10ddd7..40aa503732 100644
--- a/src/network/access/qnetworkaccesscache.cpp
+++ b/src/network/access/qnetworkaccesscache.cpp
@@ -167,22 +167,18 @@ void QNetworkAccessCache::linkEntry(const QByteArray &key)
node->previous = lastExpiringNode;
lastExpiringNode->next = node;
lastExpiringNode = node;
- Q_ASSERT(lastExpiringNode->next == nullptr);
} else {
// Insert in a sorted way, as different nodes might have had different expiryTimeoutSeconds set.
Node *current = lastExpiringNode;
- while (current->previous != nullptr && current->previous->timer >= node->timer) {
+ while (current->previous != nullptr && current->previous->timer >= node->timer)
current = current->previous;
- }
node->previous = current->previous;
if (node->previous)
node->previous->next = node;
node->next = current;
current->previous = node;
- if (node->previous == nullptr) {
+ if (node->previous == nullptr)
firstExpiringNode = node;
- Q_ASSERT(firstExpiringNode->previous == nullptr);
- }
}
} else {
// no current last-to-expire node
@@ -192,6 +188,8 @@ void QNetworkAccessCache::linkEntry(const QByteArray &key)
// there are no entries, so this is the next-to-expire too
firstExpiringNode = node;
}
+ Q_ASSERT(firstExpiringNode->previous == nullptr);
+ Q_ASSERT(lastExpiringNode->next == nullptr);
}
/*!