Bug 737164 prerequisite - move mozilla::fallible_t to its own header so that everyone can reference it reasonable, r=cjones
--- a/memory/mozalloc/Makefile.in
+++ b/memory/mozalloc/Makefile.in
@@ -66,16 +66,17 @@ endif
ifeq (,$(filter-out OS2,$(OS_ARCH)))
# The strndup declaration in string.h is in an ifdef __USE_GNU section
DEFINES += -D_GNU_SOURCE
endif
EXPORTS_NAMESPACES = mozilla
EXPORTS_mozilla = \
+ fallible.h \
mozalloc.h \
mozalloc_abort.h \
mozalloc_macro_wrappers.h \
mozalloc_oom.h \
mozalloc_undef_macro_wrappers.h \
$(NULL)
CPPSRCS = \
new file mode 100644
--- /dev/null
+++ b/memory/mozalloc/fallible.h
@@ -0,0 +1,14 @@
+/* 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_fallible_h
+#define mozilla_fallible_h
+
+namespace mozilla {
+
+struct fallible_t { };
+
+} // namespace mozilla
+
+#endif // mozilla_fallible_h
--- a/memory/mozalloc/mozalloc.h
+++ b/memory/mozalloc/mozalloc.h
@@ -47,16 +47,20 @@
#include <stdlib.h>
#include <string.h>
#if defined(__cplusplus)
# include <new>
#endif
#include "xpcom-config.h"
+#if defined(__cplusplus)
+#include "mozilla/fallible.h"
+#endif
+
#define MOZALLOC_HAVE_XMALLOC
#if defined(MOZALLOC_EXPORT)
/* do nothing: it's been defined to __declspec(dllexport) by
* mozalloc*.cpp on platforms where that's required. */
#elif defined(XP_WIN) || (defined(XP_OS2) && defined(__declspec))
# define MOZALLOC_EXPORT __declspec(dllimport)
#elif defined(HAVE_VISIBILITY_ATTRIBUTE)
@@ -286,22 +290,16 @@ void operator delete[](void* ptr, const
* delete'd by any of
*
* (1) the matching "fallible" operator delete below
* (2) the matching infallible operator delete above
* (3) the matching system |operator delete(void*, std::nothrow)|
* (4) the matching system |operator delete(void*) throw(std::bad_alloc)|
*/
-namespace mozilla {
-
-struct MOZALLOC_EXPORT fallible_t { };
-
-} /* namespace mozilla */
-
MOZALLOC_INLINE
void* operator new(size_t size, const mozilla::fallible_t&) MOZALLOC_THROW_IF_HAS_EXCEPTIONS
{
return moz_malloc(size);
}
MOZALLOC_INLINE
void* operator new[](size_t size, const mozilla::fallible_t&) MOZALLOC_THROW_IF_HAS_EXCEPTIONS