From 3d60c7ebb0bd30868b774ba0542023f923f72eae Mon Sep 17 00:00:00 2001 From: "tbogard%aol.net" Date: Mon, 1 Nov 1999 06:59:16 +0000 Subject: [PATCH] Changed NS_ENSURE to be NS_ENSURE_TRUE. Also changed NS_ENSURE_NOT to be NS_ENSURE_FALSE. Left NS_ENSURE and NS_ENSURE_NOT, but they will soon be going away. --- xpcom/base/nsISupportsUtils.h | 30 +++++++++++++++++------------- xpcom/glue/nsISupportsUtils.h | 30 +++++++++++++++++------------- 2 files changed, 34 insertions(+), 26 deletions(-) diff --git a/xpcom/base/nsISupportsUtils.h b/xpcom/base/nsISupportsUtils.h index ec0de291a2b9..57a8e77a4360 100644 --- a/xpcom/base/nsISupportsUtils.h +++ b/xpcom/base/nsISupportsUtils.h @@ -857,49 +857,53 @@ CallQueryInterface( nsISupports* aSource, DestinationType** aDestination ) // interface implementation. /////////////////////////////////////////////////////////////////////////////// -#define NS_ENSURE(x, ret) \ +#define NS_ENSURE_TRUE(x, ret) \ PR_BEGIN_MACRO \ - if(NS_WARN_IF_FALSE(x, "NS_ENSURE(" #x ") failed")) \ + if(NS_WARN_IF_FALSE(x, "NS_ENSURE_TRUE(" #x ") failed")) \ return ret; \ PR_END_MACRO -#define NS_ENSURE_NOT(x, ret) \ - NS_ENSURE(!(x), ret) +#define NS_ENSURE_FALSE(x, ret) \ + NS_ENSURE_TRUE(!(x), ret) + +// Only here until I can get rid of all the callsites. +#define NS_ENSURE(x, ret) NS_ENSURE_TRUE(x, ret) +#define NS_ENSURE_NOT(x, ret) NS_ENSURE_FALSE(x, ret) /////////////////////////////////////////////////////////////////////////////// // Macros for checking results /////////////////////////////////////////////////////////////////////////////// #define NS_ENSURE_SUCCESS(res, ret) \ - NS_ENSURE(NS_SUCCEEDED(res), ret) + NS_ENSURE_TRUE(NS_SUCCEEDED(res), ret) /////////////////////////////////////////////////////////////////////////////// // Macros for checking state and arguments upon entering interface boundaries /////////////////////////////////////////////////////////////////////////////// #define NS_ENSURE_ARG(arg) \ - NS_ENSURE(arg, NS_ERROR_INVALID_ARG) + NS_ENSURE_TRUE(arg, NS_ERROR_INVALID_ARG) #define NS_ENSURE_ARG_POINTER(arg) \ - NS_ENSURE(arg, NS_ERROR_INVALID_POINTER) + NS_ENSURE_TRUE(arg, NS_ERROR_INVALID_POINTER) #define NS_ENSURE_ARG_MIN(arg, min) \ - NS_ENSURE((arg) >= min, NS_ERROR_INVALID_ARG) + NS_ENSURE_TRUE((arg) >= min, NS_ERROR_INVALID_ARG) #define NS_ENSURE_ARG_MAX(arg, max) \ - NS_ENSURE((arg) <= min, NS_ERROR_INVALID_ARG) + NS_ENSURE_TRUE((arg) <= min, NS_ERROR_INVALID_ARG) #define NS_ENSURE_ARG_RANGE(arg, min, max) \ - NS_ENSURE(((arg) >= min) && ((arg) <= max), NS_ERROR_INVALID_ARG) + NS_ENSURE_TRUE(((arg) >= min) && ((arg) <= max), NS_ERROR_INVALID_ARG) #define NS_ENSURE_STATE(state) \ - NS_ENSURE(state, NS_ERROR_UNEXPECTED) + NS_ENSURE_TRUE(state, NS_ERROR_UNEXPECTED) #define NS_ENSURE_NO_AGGREGATION(outer) \ - NS_ENSURE_NOT(outer, NS_ERROR_NO_AGGREGATION) + NS_ENSURE_FALSE(outer, NS_ERROR_NO_AGGREGATION) #define NS_ENSURE_PROPER_AGGREGATION(outer, iid) \ - NS_ENSURE_NOT(outer && !iid.Equals(NS_GET_IID(nsISupports)), NS_ERROR_INVALID_ARG) + NS_ENSURE_FALSE(outer && !iid.Equals(NS_GET_IID(nsISupports)), NS_ERROR_INVALID_ARG) /////////////////////////////////////////////////////////////////////////////// diff --git a/xpcom/glue/nsISupportsUtils.h b/xpcom/glue/nsISupportsUtils.h index ec0de291a2b9..57a8e77a4360 100644 --- a/xpcom/glue/nsISupportsUtils.h +++ b/xpcom/glue/nsISupportsUtils.h @@ -857,49 +857,53 @@ CallQueryInterface( nsISupports* aSource, DestinationType** aDestination ) // interface implementation. /////////////////////////////////////////////////////////////////////////////// -#define NS_ENSURE(x, ret) \ +#define NS_ENSURE_TRUE(x, ret) \ PR_BEGIN_MACRO \ - if(NS_WARN_IF_FALSE(x, "NS_ENSURE(" #x ") failed")) \ + if(NS_WARN_IF_FALSE(x, "NS_ENSURE_TRUE(" #x ") failed")) \ return ret; \ PR_END_MACRO -#define NS_ENSURE_NOT(x, ret) \ - NS_ENSURE(!(x), ret) +#define NS_ENSURE_FALSE(x, ret) \ + NS_ENSURE_TRUE(!(x), ret) + +// Only here until I can get rid of all the callsites. +#define NS_ENSURE(x, ret) NS_ENSURE_TRUE(x, ret) +#define NS_ENSURE_NOT(x, ret) NS_ENSURE_FALSE(x, ret) /////////////////////////////////////////////////////////////////////////////// // Macros for checking results /////////////////////////////////////////////////////////////////////////////// #define NS_ENSURE_SUCCESS(res, ret) \ - NS_ENSURE(NS_SUCCEEDED(res), ret) + NS_ENSURE_TRUE(NS_SUCCEEDED(res), ret) /////////////////////////////////////////////////////////////////////////////// // Macros for checking state and arguments upon entering interface boundaries /////////////////////////////////////////////////////////////////////////////// #define NS_ENSURE_ARG(arg) \ - NS_ENSURE(arg, NS_ERROR_INVALID_ARG) + NS_ENSURE_TRUE(arg, NS_ERROR_INVALID_ARG) #define NS_ENSURE_ARG_POINTER(arg) \ - NS_ENSURE(arg, NS_ERROR_INVALID_POINTER) + NS_ENSURE_TRUE(arg, NS_ERROR_INVALID_POINTER) #define NS_ENSURE_ARG_MIN(arg, min) \ - NS_ENSURE((arg) >= min, NS_ERROR_INVALID_ARG) + NS_ENSURE_TRUE((arg) >= min, NS_ERROR_INVALID_ARG) #define NS_ENSURE_ARG_MAX(arg, max) \ - NS_ENSURE((arg) <= min, NS_ERROR_INVALID_ARG) + NS_ENSURE_TRUE((arg) <= min, NS_ERROR_INVALID_ARG) #define NS_ENSURE_ARG_RANGE(arg, min, max) \ - NS_ENSURE(((arg) >= min) && ((arg) <= max), NS_ERROR_INVALID_ARG) + NS_ENSURE_TRUE(((arg) >= min) && ((arg) <= max), NS_ERROR_INVALID_ARG) #define NS_ENSURE_STATE(state) \ - NS_ENSURE(state, NS_ERROR_UNEXPECTED) + NS_ENSURE_TRUE(state, NS_ERROR_UNEXPECTED) #define NS_ENSURE_NO_AGGREGATION(outer) \ - NS_ENSURE_NOT(outer, NS_ERROR_NO_AGGREGATION) + NS_ENSURE_FALSE(outer, NS_ERROR_NO_AGGREGATION) #define NS_ENSURE_PROPER_AGGREGATION(outer, iid) \ - NS_ENSURE_NOT(outer && !iid.Equals(NS_GET_IID(nsISupports)), NS_ERROR_INVALID_ARG) + NS_ENSURE_FALSE(outer && !iid.Equals(NS_GET_IID(nsISupports)), NS_ERROR_INVALID_ARG) ///////////////////////////////////////////////////////////////////////////////