Bug 737164 prerequisite - move mozilla::fallible_t to its own header so that everyone can reference it reasonable, r=cjones
authorBenjamin Smedberg <benjamin@smedbergs.us>
Tue, 08 May 2012 12:30:37 -0400
changeset 93748 45ffd4b20e11b28075899561c93517aab21a000d
parent 93747 6a7bfd84596e65c9d8704a510bd5b6a230fd7558
child 93749 39e55d53e0a3aebc779fd3b42ffdf34897086b19
push idunknown
push userunknown
push dateunknown
reviewerscjones
bugs737164
milestone15.0a1
Bug 737164 prerequisite - move mozilla::fallible_t to its own header so that everyone can reference it reasonable, r=cjones
memory/mozalloc/Makefile.in
memory/mozalloc/fallible.h
memory/mozalloc/mozalloc.h
--- 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