From fe6a33b7ec4800f5dfbe5b6a402d49df515790f3 Mon Sep 17 00:00:00 2001 From: Simon Giesecke Date: Tue, 2 Feb 2021 10:10:45 +0000 Subject: [PATCH] Bug 1685677 - Reduce scope of variables only used within an if statement. r=jstutte Differential Revision: https://phabricator.services.mozilla.com/D101181 --- dom/quota/ActorsParent.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dom/quota/ActorsParent.cpp b/dom/quota/ActorsParent.cpp index bd73cf7dc29d..4f374059d1b2 100644 --- a/dom/quota/ActorsParent.cpp +++ b/dom/quota/ActorsParent.cpp @@ -6437,8 +6437,8 @@ QuotaManager::EnsurePersistentOriginIsInitialized(const QuotaInfo& aQuotaInfo) { return std::pair(std::move(directory), created); }(); - auto& info = mOriginInitializationInfos.GetOrInsert(aQuotaInfo.mOrigin); - if (!info.mPersistentOriginAttempted) { + if (auto& info = mOriginInitializationInfos.GetOrInsert(aQuotaInfo.mOrigin); + !info.mPersistentOriginAttempted) { Telemetry::Accumulate(Telemetry::QM_FIRST_INITIALIZATION_ATTEMPT, kPersistentOriginTelemetryKey, static_cast(res.isOk())); @@ -7038,8 +7038,8 @@ void QuotaManager::LockedRemoveQuotaForOrigin( MOZ_ASSERT(pair); - RefPtr groupInfo = pair->LockedGetGroupInfo(aPersistenceType); - if (groupInfo) { + if (RefPtr groupInfo = + pair->LockedGetGroupInfo(aPersistenceType)) { groupInfo->LockedRemoveOriginInfo(aGroupAndOrigin.mOrigin); if (!groupInfo->LockedHasOriginInfos()) { @@ -7376,8 +7376,8 @@ bool QuotaManager::IsSanitizedOriginValid(const nsACString& aSanitizedOrigin) { int64_t QuotaManager::GenerateDirectoryLockId() { const int64_t directorylockId = mNextDirectoryLockId; - CheckedInt64 result = CheckedInt64(mNextDirectoryLockId) + 1; - if (result.isValid()) { + if (CheckedInt64 result = CheckedInt64(mNextDirectoryLockId) + 1; + result.isValid()) { mNextDirectoryLockId = result.value(); } else { NS_WARNING("Quota manager has run out of ids for directory locks!");