Bug 1365460 - Define _malloc_message as a function instead of a pointer to a function. r?njn draft
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 18 May 2017 10:18:36 +0900
changeset 580752 b372e0747df72c4517efe13fa8855df9604afdfb
parent 580751 0d0c88adb0bcc543ac5149c95f6663c3343984b9
child 580753 3c6592e2c5f037657a0861aeed7ed209c08373c5
push id59654
push userbmo:mh+mozilla@glandium.org
push dateThu, 18 May 2017 22:44:22 +0000
reviewersnjn
bugs1365460
milestone55.0a1
Bug 1365460 - Define _malloc_message as a function instead of a pointer to a function. r?njn
memory/mozjemalloc/mozjemalloc.cpp
--- 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)