Bug 1411155 - Fix MOZ_DEBUG parts of mozjemalloc. r=njn
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 24 Oct 2017 14:11:14 +0900
changeset 685709 ba502bdf9d9c69a5830eae00d90512f53dc3ada2
parent 685708 51a6e6d8ce203daf6e1bea0fe0e2fc5e2640661a
child 685710 afde6e60e63d07841359202a418548154385a149
push id86016
push userkgupta@mozilla.com
push dateWed, 25 Oct 2017 01:53:44 +0000
reviewersnjn
bugs1411155
milestone58.0a1
Bug 1411155 - Fix MOZ_DEBUG parts of mozjemalloc. r=njn
memory/build/mozjemalloc.cpp
--- a/memory/build/mozjemalloc.cpp
+++ b/memory/build/mozjemalloc.cpp
@@ -1180,17 +1180,17 @@ static size_t	opt_dirty_max = DIRTY_MAX_
 
 /******************************************************************************/
 /*
  * Begin forward declarations.
  */
 
 static void	*chunk_alloc(size_t size, size_t alignment, bool base, bool *zeroed=nullptr);
 static void	chunk_dealloc(void *chunk, size_t size, ChunkType chunk_type);
-static void	chunk_ensure_zero(void* ptr, size_t size, bool zeroed);
+static void chunk_ensure_zero(void* aPtr, size_t aSize, bool aZeroed);
 static arena_t	*arenas_extend();
 static void	*huge_malloc(size_t size, bool zero);
 static void* huge_palloc(size_t aSize, size_t aAlignment, bool aZero);
 static void* huge_ralloc(void* aPtr, size_t aSize, size_t aOldSize);
 static void huge_dalloc(void* aPtr);
 #ifdef XP_WIN
 extern "C"
 #else
@@ -2085,28 +2085,30 @@ RETURN:
 		}
 	}
 
 	MOZ_ASSERT(CHUNK_ADDR2BASE(ret) == ret);
 	return (ret);
 }
 
 static void
-chunk_ensure_zero(void* ptr, size_t size, bool zeroed)
+chunk_ensure_zero(void* aPtr, size_t aSize, bool aZeroed)
 {
-	if (zeroed == false)
-		memset(ptr, 0, size);
+  if (aZeroed == false) {
+    memset(aPtr, 0, aSize);
+  }
 #ifdef MOZ_DEBUG
-	else {
-		size_t i;
-		size_t *p = (size_t *)(uintptr_t)ret;
-
-		for (i = 0; i < size / sizeof(size_t); i++)
-			MOZ_ASSERT(p[i] == 0);
-	}
+  else {
+    size_t i;
+    size_t* p = (size_t*)(uintptr_t)aPtr;
+
+    for (i = 0; i < aSize / sizeof(size_t); i++) {
+      MOZ_ASSERT(p[i] == 0);
+    }
+  }
 #endif
 }
 
 static void
 chunk_record(RedBlackTree<extent_node_t, ExtentTreeSzTrait>* chunks_szad,
              RedBlackTree<extent_node_t, ExtentTreeTrait>* chunks_ad,
              void *chunk, size_t size, ChunkType chunk_type)
 {