Bug 1411155 - Fix MOZ_DEBUG parts of mozjemalloc. r?njn
--- 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)
{