QHsts: code tidies

1) Remove a use-after-move. It was benign because the move didn't
actually trigger move assignment, as the original object was const.

2) Remove a usage of insert(hint), as the hint was always end(),
and there is no reason to believe that that's the insertion place.

Change-Id: I71aac8cdc9fb85b6ecef3695bae7b21f022bb60b
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
 
 
 
 
 
 
 
 
 
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Giuseppe D'Angelo 2019-05-13 18:19:29 +02:00
parent c2d2757bcc
commit cceeb1ee7e

View File

@ -145,7 +145,7 @@ void QHstsCache::updateKnownHost(const QString &host, const QDateTime &expires,
return; return;
} }
knownHosts.insert(pos, {hostName, newPolicy}); knownHosts.insert({hostName, newPolicy});
#if QT_CONFIG(settings) #if QT_CONFIG(settings)
if (hstsStore) if (hstsStore)
hstsStore->addToObserved(newPolicy); hstsStore->addToObserved(newPolicy);
@ -156,7 +156,7 @@ void QHstsCache::updateKnownHost(const QString &host, const QDateTime &expires,
if (newPolicy.isExpired()) if (newPolicy.isExpired())
knownHosts.erase(pos); knownHosts.erase(pos);
else if (pos->second != newPolicy) else if (pos->second != newPolicy)
pos->second = std::move(newPolicy); pos->second = newPolicy;
else else
return; return;