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:
Simon Ser 2019-10-31 16:57:02 +01:00
parent 1b51db68f9
commit 8ade6b654b
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48

View file

@ -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) \