mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-19 21:28:50 +00:00
xrt: introduce OXR_VERIFY_ARG_TYPE_CAN_BE_NULL
It's like OXR_VERIFY_ARG_TYPE_AND_NOT_NULL, but doesn't ensure the argument is non-NULL.
This commit is contained in:
parent
1b51db68f9
commit
8ade6b654b
|
@ -112,16 +112,21 @@ extern "C" {
|
|||
} \
|
||||
} while (false)
|
||||
|
||||
#define OXR_VERIFY_ARG_TYPE_CAN_BE_NULL(log, arg, type_enum) \
|
||||
do { \
|
||||
if (arg != NULL && arg->type != type_enum) { \
|
||||
return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, \
|
||||
"(" #arg "->type == %u)", arg->type); \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
#define OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(log, arg, type_enum) \
|
||||
do { \
|
||||
if (arg == NULL) { \
|
||||
return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, \
|
||||
"(" #arg "== NULL)"); \
|
||||
} \
|
||||
if (arg->type != type_enum) { \
|
||||
return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, \
|
||||
"(" #arg "->type = %u)", arg->type); \
|
||||
"(" #arg " == NULL)"); \
|
||||
} \
|
||||
OXR_VERIFY_ARG_TYPE_CAN_BE_NULL(log, arg, type_enum); \
|
||||
} while (false)
|
||||
|
||||
#define OXR_VERIFY_SUBACTION_PATHS(log, count, paths) \
|
||||
|
|
Loading…
Reference in a new issue