success-macros.patch
author Benjamin Smedberg <benjamin@smedbergs.us>
Sat, 26 Jul 2008 22:49:39 -0400
changeset 167 a4da40849f5436e629c5732f4368c6c48189637f
parent 123 55f4c3203c4f384a083cc87cccea108f7db740b9
permissions -rw-r--r--
State as of now

diff --git a/xpcom/base/nsError.h b/xpcom/base/nsError.h
--- a/xpcom/base/nsError.h
+++ b/xpcom/base/nsError.h
@@ -112,18 +112,21 @@
  * @return 0 or 1
  */
 
-#if defined(NS_STATIC_CHECKING) && defined(__cplusplus)
-inline int NS_FAILED(nsresult _nsresult) {
-  return _nsresult & 0x80000000;
+#if !defined(__cplusplus) && defined(_MSC_VER)
+#define NS_INLINE __inline
+#else
+#define NS_INLINE inline
+#endif
+
+NS_INLINE PRBool NS_FAILED(nsresult _nsresult)
+{
+  return !!(_nsresult & 0x80000000);
 }
 
-inline int NS_SUCCEEDED(nsresult _nsresult) {
+NS_INLINE PRBool NS_SUCCEEDED(nsresult _nsresult)
+{
   return !(_nsresult & 0x80000000);
 }
-#else
-#define NS_FAILED(_nsresult) (NS_UNLIKELY((_nsresult) & 0x80000000))
-#define NS_SUCCEEDED(_nsresult) (NS_LIKELY(!((_nsresult) & 0x80000000)))
-#endif
 
 /**
  * @name Severity Code.  This flag identifies the level of warning