diff options
author | Stefan Metzmacher <metze@samba.org> | 2005-01-09 02:30:01 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:08:32 -0500 |
commit | e0b0d934ec5894bb9833c3b93d1d103778aa81fa (patch) | |
tree | 4ca6c866d5381bc89e07d321db95ff6310bf7c05 | |
parent | fd254e01b6b07ae363008b51acecb03301ee3026 (diff) | |
download | samba-e0b0d934ec5894bb9833c3b93d1d103778aa81fa.tar.gz samba-e0b0d934ec5894bb9833c3b93d1d103778aa81fa.tar.bz2 samba-e0b0d934ec5894bb9833c3b93d1d103778aa81fa.zip |
r4607: add some usefull macros to make the code more readable
metze
(This used to be commit 62c45635ff8a158acefd4ae2aae2ffc352a97113)
-rw-r--r-- | source4/include/nt_status.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/source4/include/nt_status.h b/source4/include/nt_status.h index 71c69cc441..0ef443d355 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 */ |