diff --git a/extensions/spellcheck/hunspell/src/hunspell_alloc_hooks.h b/extensions/spellcheck/hunspell/src/hunspell_alloc_hooks.h index 8c600744b05f..8cd83dbca565 100644 --- a/extensions/spellcheck/hunspell/src/hunspell_alloc_hooks.h +++ b/extensions/spellcheck/hunspell/src/hunspell_alloc_hooks.h @@ -47,9 +47,6 @@ * allocated using C memory allocation functions. */ -// Prevent the standard macros from being redefined -#define mozilla_mozalloc_macro_wrappers_h - #include "mozilla/mozalloc.h" extern void HunspellReportMemoryAllocation(void*); diff --git a/ipc/chromium/src/base/message_pump_qt.h b/ipc/chromium/src/base/message_pump_qt.h index ccf403a4feba..48a956756ff9 100644 --- a/ipc/chromium/src/base/message_pump_qt.h +++ b/ipc/chromium/src/base/message_pump_qt.h @@ -5,11 +5,6 @@ #ifndef BASE_MESSAGE_PUMP_QT_H_ #define BASE_MESSAGE_PUMP_QT_H_ -#ifdef mozilla_mozalloc_macro_wrappers_h -/* The "anti-header" */ -# include "mozilla/mozalloc_undef_macro_wrappers.h" -#endif - #include #include "base/message_pump.h" diff --git a/memory/mozalloc/moz.build b/memory/mozalloc/moz.build index 191523e852a3..850e39d9b1c8 100644 --- a/memory/mozalloc/moz.build +++ b/memory/mozalloc/moz.build @@ -11,9 +11,7 @@ EXPORTS.mozilla += [ 'fallible.h', 'mozalloc.h', 'mozalloc_abort.h', - 'mozalloc_macro_wrappers.h', 'mozalloc_oom.h', - 'mozalloc_undef_macro_wrappers.h', ] if CONFIG['MOZ_MSVC_STL_WRAP__RAISE'] or CONFIG['MOZ_MSVC_STL_WRAP__Throw']: diff --git a/memory/mozalloc/mozalloc.cpp b/memory/mozalloc/mozalloc.cpp index 5da9943726c0..f43e0bb63b9e 100644 --- a/memory/mozalloc/mozalloc.cpp +++ b/memory/mozalloc/mozalloc.cpp @@ -24,8 +24,6 @@ # define MOZALLOC_EXPORT __declspec(dllexport) #endif -// Make sure that "malloc" et al. resolve to their libc variants. -#define MOZALLOC_DONT_DEFINE_MACRO_WRAPPERS #include "mozilla/mozalloc.h" #include "mozilla/mozalloc_oom.h" // for mozalloc_handle_oom diff --git a/memory/mozalloc/mozalloc_macro_wrappers.h b/memory/mozalloc/mozalloc_macro_wrappers.h deleted file mode 100644 index 465a58784f8b..000000000000 --- a/memory/mozalloc/mozalloc_macro_wrappers.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * vim: sw=4 ts=4 et : - */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef mozilla_mozalloc_macro_wrappers_h -#define mozilla_mozalloc_macro_wrappers_h - - -/* - * Make libc "allocating functions" never fail (return NULL). - * - * FIXME: use infallible allocators by default after - * http://bugzilla.mozilla.org/show_bug.cgi?id=507249 - * lands. - */ -#define free(_) moz_free(_) - -#define malloc(_) moz_malloc(_) - -#define calloc(_, __) moz_calloc(_, __) - -#define realloc(_, __) moz_realloc(_, __) - -/* - * Note: on some platforms, strdup may be a macro instead of a function. - * So we have to #undef it to avoid build warnings about redefining it. - */ -#undef strdup -#define strdup(_) moz_strdup(_) - -#if defined(HAVE_STRNDUP) -#define strndup(_, __) moz_strndup(_, __) -#endif - -#if defined(HAVE_POSIX_MEMALIGN) -#define posix_memalign(_, __, ___) moz_posix_memalign(_, __, ___) -#endif - -#if defined(HAVE_MEMALIGN) -#define memalign(_, __) moz_memalign(_, __) -#endif - -#if defined(HAVE_VALLOC) -#define valloc(_) moz_valloc(_) -#endif - - -#endif /* ifndef mozilla_mozalloc_macro_wrappers_h */ diff --git a/memory/mozalloc/mozalloc_undef_macro_wrappers.h b/memory/mozalloc/mozalloc_undef_macro_wrappers.h deleted file mode 100644 index 0ab5c28f9a09..000000000000 --- a/memory/mozalloc/mozalloc_undef_macro_wrappers.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * vim: sw=4 ts=4 et : - */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/* - * This header is the "anti-header" for mozalloc_macro_wrappers.h. - * Including it undefines all the macros defined by - * mozalloc_macro_wrappers.h. - */ - -#ifndef mozilla_mozalloc_macro_wrappers_h -# error "mozalloc macro wrappers haven't been defined" -#endif - -/* - * This allows the wrappers to be redefined by including - * mozalloc_macro_wrappers.h again - */ -#undef mozilla_mozalloc_macro_wrappers_h - -#undef free -#undef malloc -#undef calloc -#undef realloc -#undef strdup - -#if defined(HAVE_STRNDUP) -# undef strndup -#endif - -#if defined(HAVE_POSIX_MEMALIGN) -# undef posix_memalign -#endif - -#if defined(HAVE_MEMALIGN) -# undef memalign -#endif - -#if defined(HAVE_VALLOC) -# undef valloc -#endif diff --git a/tools/jprof/stub/libmalloc.cpp b/tools/jprof/stub/libmalloc.cpp index ea74941f2288..c68d65bf9eb8 100644 --- a/tools/jprof/stub/libmalloc.cpp +++ b/tools/jprof/stub/libmalloc.cpp @@ -37,8 +37,6 @@ #include #include -#include "mozilla/mozalloc_undef_macro_wrappers.h" - // Must define before including jprof.h void *moz_xmalloc(size_t size) { diff --git a/xpcom/base/nscore.h b/xpcom/base/nscore.h index b4f1489bbe62..c21c017ce7d9 100644 --- a/xpcom/base/nscore.h +++ b/xpcom/base/nscore.h @@ -17,7 +17,6 @@ /* Definitions of functions and operators that allocate memory. */ #if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC) # include "mozilla/mozalloc.h" -# include "mozilla/mozalloc_macro_wrappers.h" #endif /**