Bug 1316290 - Use 'auto' type specifier for some variable decls that are assigned to "new", in /layout. r?dholbert draft
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Wed, 09 Nov 2016 15:34:49 +0200
changeset 437647 866d08001947f593407c306725f0bef9d18bb429
parent 437246 d38d06f85ef59c5dbb5d4a1a8d895957a78714de
child 437648 f3b1957daba7901a5fe5cf2c28d3e2fb7b20dc88
push id35472
push userbmo:bpostelnicu@mozilla.com
push dateFri, 11 Nov 2016 08:13:47 +0000
reviewersdholbert
bugs1316290
milestone52.0a1
Bug 1316290 - Use 'auto' type specifier for some variable decls that are assigned to "new", in /layout. r?dholbert MozReview-Commit-ID: hEBEzzmMlC
layout/base/nsRefreshDriver.cpp
layout/style/nsCSSRuleProcessor.cpp
--- a/layout/base/nsRefreshDriver.cpp
+++ b/layout/base/nsRefreshDriver.cpp
@@ -2232,18 +2232,18 @@ nsRefreshDriver::SetThrottled(bool aThro
   }
 }
 
 /*static*/ void
 nsRefreshDriver::PVsyncActorCreated(VsyncChild* aVsyncChild)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(!XRE_IsParentProcess());
-  VsyncRefreshDriverTimer* vsyncRefreshDriverTimer =
-                           new VsyncRefreshDriverTimer(aVsyncChild);
+  auto* vsyncRefreshDriverTimer =
+      new VsyncRefreshDriverTimer(aVsyncChild);
 
   // If we are using software timer, swap current timer to
   // VsyncRefreshDriverTimer.
   if (sRegularRateTimer) {
     sRegularRateTimer->SwapRefreshDrivers(vsyncRefreshDriverTimer);
     delete sRegularRateTimer;
   }
   sRegularRateTimer = vsyncRefreshDriverTimer;
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -274,17 +274,17 @@ RuleHash_ClearEntry(PLDHashTable *table,
 static void
 RuleHash_MoveEntry(PLDHashTable *table, const PLDHashEntryHdr *from,
                    PLDHashEntryHdr *to)
 {
   NS_PRECONDITION(from != to, "This is not going to work!");
   RuleHashTableEntry *oldEntry =
     const_cast<RuleHashTableEntry*>(
       static_cast<const RuleHashTableEntry*>(from));
-  RuleHashTableEntry *newEntry = new (KnownNotNull, to) RuleHashTableEntry();
+  auto* newEntry = new (KnownNotNull, to) RuleHashTableEntry();
   newEntry->mRules.SwapElements(oldEntry->mRules);
   oldEntry->~RuleHashTableEntry();
 }
 
 static bool
 RuleHash_TagTable_MatchEntry(const PLDHashEntryHdr *hdr, const void *key)
 {
   nsIAtom *match_atom = const_cast<nsIAtom*>(static_cast<const nsIAtom*>(key));
@@ -311,17 +311,17 @@ RuleHash_TagTable_ClearEntry(PLDHashTabl
 static void
 RuleHash_TagTable_MoveEntry(PLDHashTable *table, const PLDHashEntryHdr *from,
                             PLDHashEntryHdr *to)
 {
   NS_PRECONDITION(from != to, "This is not going to work!");
   RuleHashTagTableEntry *oldEntry =
     const_cast<RuleHashTagTableEntry*>(
       static_cast<const RuleHashTagTableEntry*>(from));
-  RuleHashTagTableEntry *newEntry = new (KnownNotNull, to) RuleHashTagTableEntry();
+  auto* newEntry = new (KnownNotNull, to) RuleHashTagTableEntry();
   newEntry->mTag.swap(oldEntry->mTag);
   newEntry->mRules.SwapElements(oldEntry->mRules);
   oldEntry->~RuleHashTagTableEntry();
 }
 
 static PLDHashNumber
 RuleHash_NameSpaceTable_HashKey(const void *key)
 {
@@ -801,17 +801,17 @@ AtomSelector_InitEntry(PLDHashEntryHdr *
 
 static void
 AtomSelector_MoveEntry(PLDHashTable *table, const PLDHashEntryHdr *from,
                        PLDHashEntryHdr *to)
 {
   NS_PRECONDITION(from != to, "This is not going to work!");
   AtomSelectorEntry *oldEntry =
     const_cast<AtomSelectorEntry*>(static_cast<const AtomSelectorEntry*>(from));
-  AtomSelectorEntry *newEntry = new (KnownNotNull, to) AtomSelectorEntry();
+  auto* newEntry = new (KnownNotNull, to) AtomSelectorEntry();
   newEntry->mAtom = oldEntry->mAtom;
   newEntry->mSelectors.SwapElements(oldEntry->mSelectors);
   oldEntry->~AtomSelectorEntry();
 }
 
 static bool
 AtomSelector_CIMatchEntry(const PLDHashEntryHdr *hdr, const void *key)
 {
@@ -3601,17 +3601,17 @@ CascadeRuleEnumFunc(css::Rule* aRule, vo
       int32_t weight = sel->mWeight;
       auto entry = static_cast<RuleByWeightEntry*>
         (data->mRulesByWeight.Add(NS_INT32_TO_PTR(weight), fallible));
       if (!entry)
         return false;
       entry->data.mWeight = weight;
       // entry->data.mRuleSelectorPairs should be linked in forward order;
       // entry->data.mTail is the slot to write to.
-      PerWeightDataListItem *newItem =
+      auto* newItem =
         new (data->mArena) PerWeightDataListItem(styleRule, sel->mSelectors);
       if (newItem) {
         *(entry->data.mTail) = newItem;
         entry->data.mTail = &newItem->mNext;
       }
     }
   }
   else if (css::Rule::MEDIA_RULE == type ||