1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

r4607: add some usefull macros to make the code more readable

metze
(This used to be commit 62c45635ff)
This commit is contained in:
Stefan Metzmacher 2005-01-09 02:30:01 +00:00 committed by Gerald (Jerry) Carter
parent fd254e01b6
commit e0b0d934ec

View File

@ -64,6 +64,30 @@ typedef uint32_t WERROR;
}\ }\
} while (0) } 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_IS_OK(x) (W_ERROR_V(x) == 0)
#define W_ERROR_EQUAL(x,y) (W_ERROR_V(x) == W_ERROR_V(y)) #define W_ERROR_EQUAL(x,y) (W_ERROR_V(x) == W_ERROR_V(y))
@ -73,6 +97,18 @@ typedef uint32_t WERROR;
}\ }\
} while (0) } 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 /* this defines special NTSTATUS codes to represent DOS errors. I
have chosen this macro to produce status codes in the invalid have chosen this macro to produce status codes in the invalid
NTSTATUS range */ NTSTATUS range */