From e0b0d934ec5894bb9833c3b93d1d103778aa81fa Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sun, 9 Jan 2005 02:30:01 +0000 Subject: [PATCH] r4607: add some usefull macros to make the code more readable metze (This used to be commit 62c45635ff8a158acefd4ae2aae2ffc352a97113) --- source4/include/nt_status.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/source4/include/nt_status.h b/source4/include/nt_status.h index 71c69cc441d..0ef443d3556 100644 --- a/source4/include/nt_status.h +++ b/source4/include/nt_status.h @@ -64,6 +64,30 @@ typedef uint32_t WERROR; }\ } while (0) +#define NT_STATUS_IS_OK_RETURN(x) do { \ + if (NT_STATUS_IS_OK(x)) {\ + return x;\ + }\ +} while (0) + +#define NT_STATUS_NOT_OK_RETURN(x) do { \ + if (!NT_STATUS_IS_OK(x)) {\ + return x;\ + }\ +} while (0) + +#define NT_STATUS_IS_ERR_RETURN(x) do { \ + if (NT_STATUS_IS_ERR(x)) {\ + return x;\ + }\ +} while (0) + +#define NT_STATUS_NOT_ERR_RETURN(x) do { \ + if (!NT_STATUS_IS_ERR(x)) {\ + return x;\ + }\ +} while (0) + #define W_ERROR_IS_OK(x) (W_ERROR_V(x) == 0) #define W_ERROR_EQUAL(x,y) (W_ERROR_V(x) == W_ERROR_V(y)) @@ -73,6 +97,18 @@ typedef uint32_t WERROR; }\ } while (0) +#define W_ERROR_IS_OK_RETURN(x) do { \ + if (W_ERROR_IS_OK(x)) {\ + return x;\ + }\ +} while (0) + +#define W_ERROR_NOT_OK_RETURN(x) do { \ + if (!W_ERROR_IS_OK(x)) {\ + return x;\ + }\ +} while (0) + /* this defines special NTSTATUS codes to represent DOS errors. I have chosen this macro to produce status codes in the invalid NTSTATUS range */