Bug 1411155 - Fix MOZ_DEBUG parts of mozjemalloc. r?njn draft
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 24 Oct 2017 14:11:14 +0900
changeset 685218 4b1d21473dc647509f17c19a2a92ccc6d06f07ab
parent 685212 7422212754cc911890932b30e33f9351ab51c087
child 685220 0c3fc661292a41eba1904b8603774cdcb822af01
child 685222 678b92500993270d6b62362f27bf2c652a25790d
child 685223 ca9461bc853e622e0ed148e7b45aebdc5fed6af0
push id85850
push userbmo:mh+mozilla@glandium.org
push dateTue, 24 Oct 2017 05:15:50 +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)
 {