Bug 1196430 - part 8 - use less reinterpret_cast in nsTraceRefcnt.cpp; r=mccr8
authorNathan Froyd <froydnj@mozilla.com>
Wed, 26 Aug 2015 22:57:32 -0400
changeset 294407 5b0c8bcaaa9a7deea45ed6a54dd91ac9d204126a
parent 294406 3f6c4bdd629574281b4648545f963b05cd0774a6
child 294408 3b86c35c0e9abecf45b47bfae942dfe1026d06b6
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1196430
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1196430 - part 8 - use less reinterpret_cast in nsTraceRefcnt.cpp; r=mccr8
xpcom/base/nsTraceRefcnt.cpp
--- a/xpcom/base/nsTraceRefcnt.cpp
+++ b/xpcom/base/nsTraceRefcnt.cpp
@@ -197,26 +197,26 @@ DefaultAllocEntry(void* aPool, const voi
 {
   return PR_NEW(PLHashEntry);
 }
 
 static void
 SerialNumberFreeEntry(void* aPool, PLHashEntry* aHashEntry, unsigned aFlag)
 {
   if (aFlag == HT_FREE_ENTRY) {
-    delete reinterpret_cast<SerialNumberRecord*>(aHashEntry->value);
+    delete static_cast<SerialNumberRecord*>(aHashEntry->value);
     PR_Free(aHashEntry);
   }
 }
 
 static void
 TypesToLogFreeEntry(void* aPool, PLHashEntry* aHashEntry, unsigned aFlag)
 {
   if (aFlag == HT_FREE_ENTRY) {
-    free(const_cast<char*>(reinterpret_cast<const char*>(aHashEntry->key)));
+    free(const_cast<char*>(static_cast<const char*>(aHashEntry->key)));
     PR_Free(aHashEntry);
   }
 }
 
 static const PLHashAllocOps serialNumberHashAllocOps = {
   DefaultAllocTable, DefaultFreeTable,
   DefaultAllocEntry, SerialNumberFreeEntry
 };
@@ -400,17 +400,17 @@ protected:
   nsTraceRefcntStats mNewStats;
   nsTraceRefcntStats mAllStats;
 };
 
 static void
 BloatViewFreeEntry(void* aPool, PLHashEntry* aHashEntry, unsigned aFlag)
 {
   if (aFlag == HT_FREE_ENTRY) {
-    BloatEntry* entry = reinterpret_cast<BloatEntry*>(aHashEntry->value);
+    BloatEntry* entry = static_cast<BloatEntry*>(aHashEntry->value);
     delete entry;
     PR_Free(aHashEntry);
   }
 }
 
 const static PLHashAllocOps bloatViewHashAllocOps = {
   DefaultAllocTable, DefaultFreeTable,
   DefaultAllocEntry, BloatViewFreeEntry
@@ -459,17 +459,17 @@ GetBloatEntry(const char* aTypeName, uin
   }
   return entry;
 }
 
 static int
 DumpSerialNumbers(PLHashEntry* aHashEntry, int aIndex, void* aClosure)
 {
   SerialNumberRecord* record =
-    reinterpret_cast<SerialNumberRecord*>(aHashEntry->value);
+    static_cast<SerialNumberRecord*>(aHashEntry->value);
   auto* outputFile = static_cast<FILE*>(aClosure);
 #ifdef HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
   fprintf(outputFile, "%" PRIdPTR
           " @%p (%d references; %d from COMPtrs)\n",
           record->serialNumber,
           NS_INT32_TO_PTR(aHashEntry->key),
           record->refCount,
           record->COMPtrCount);
@@ -602,49 +602,49 @@ HashNumber(const void* aKey)
 
 static intptr_t
 GetSerialNumber(void* aPtr, bool aCreate)
 {
   PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers,
                                             HashNumber(aPtr),
                                             aPtr);
   if (hep && *hep) {
-    return reinterpret_cast<SerialNumberRecord*>((*hep)->value)->serialNumber;
+    return static_cast<SerialNumberRecord*>((*hep)->value)->serialNumber;
   } else if (aCreate) {
     SerialNumberRecord* record = new SerialNumberRecord();
     WalkTheStackSavingLocations(record->allocationStack);
     PL_HashTableRawAdd(gSerialNumbers, hep, HashNumber(aPtr),
-                       aPtr, reinterpret_cast<void*>(record));
+                       aPtr, static_cast<void*>(record));
     return gNextSerialNumber;
   }
   return 0;
 }
 
 static int32_t*
 GetRefCount(void* aPtr)
 {
   PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers,
                                             HashNumber(aPtr),
                                             aPtr);
   if (hep && *hep) {
-    return &((reinterpret_cast<SerialNumberRecord*>((*hep)->value))->refCount);
+    return &(static_cast<SerialNumberRecord*>((*hep)->value)->refCount);
   } else {
     return nullptr;
   }
 }
 
 #if defined(NS_IMPL_REFCNT_LOGGING) && defined(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
 static int32_t*
 GetCOMPtrCount(void* aPtr)
 {
   PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers,
                                             HashNumber(aPtr),
                                             aPtr);
   if (hep && *hep) {
-    return &((reinterpret_cast<SerialNumberRecord*>((*hep)->value))->COMPtrCount);
+    return &(static_cast<SerialNumberRecord*>((*hep)->value)->COMPtrCount);
   }
   return nullptr;
 }
 #endif
 
 static void
 RecycleSerialNumberPtr(void* aPtr)
 {