Bug 1365460 - Define _malloc_message as a function instead of a pointer to a function. r?njn
--- a/memory/mozjemalloc/mozjemalloc.cpp
+++ b/memory/mozjemalloc/mozjemalloc.cpp
@@ -1096,18 +1096,16 @@ static bool opt_xmalloc = false;
/******************************************************************************/
/*
* Begin function prototypes for non-inline static functions.
*/
static char *umax2s(uintmax_t x, unsigned base, char *s);
static bool malloc_mutex_init(malloc_mutex_t *mutex);
static bool malloc_spin_init(malloc_spinlock_t *lock);
-static void wrtmessage(const char *p1, const char *p2, const char *p3,
- const char *p4);
#ifdef MOZ_MEMORY_DARWIN
/* Avoid namespace collision with OS X's malloc APIs. */
#define malloc_printf moz_malloc_printf
#endif
static void malloc_printf(const char *format, ...);
static bool base_pages_alloc(size_t minsize);
static void *base_alloc(size_t size);
static void *base_calloc(size_t number, size_t size);
@@ -1233,36 +1231,33 @@ umax2s(uintmax_t x, unsigned base, char
x /= base;
} while (x > 0);
}
return (&s[i]);
}
static void
-wrtmessage(const char *p1, const char *p2, const char *p3, const char *p4)
+_malloc_message(const char *p1, const char *p2, const char *p3, const char *p4)
{
#if !defined(MOZ_MEMORY_WINDOWS)
#define _write write
#endif
// Pretend to check _write() errors to suppress gcc warnings about
// warn_unused_result annotations in some versions of glibc headers.
if (_write(STDERR_FILENO, p1, (unsigned int) strlen(p1)) < 0)
return;
if (_write(STDERR_FILENO, p2, (unsigned int) strlen(p2)) < 0)
return;
if (_write(STDERR_FILENO, p3, (unsigned int) strlen(p3)) < 0)
return;
if (_write(STDERR_FILENO, p4, (unsigned int) strlen(p4)) < 0)
return;
}
-void (*_malloc_message)(const char *p1, const char *p2, const char *p3,
- const char *p4) = wrtmessage;
-
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/TaggedAnonymousMemory.h"
// Note: MozTaggedAnonymousMmap() could call an LD_PRELOADed mmap
// instead of the one defined here; use only MozTagAnonymousMemory().
#ifdef MALLOC_DEBUG
# define assert(e) MOZ_ASSERT(e)