mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-02-01 03:18:26 +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)
|
} 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) \
|
#define OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(log, arg, type_enum) \
|
||||||
do { \
|
do { \
|
||||||
if (arg == NULL) { \
|
if (arg == NULL) { \
|
||||||
return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, \
|
return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, \
|
||||||
"(" #arg "== NULL)"); \
|
"(" #arg " == NULL)"); \
|
||||||
} \
|
|
||||||
if (arg->type != type_enum) { \
|
|
||||||
return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, \
|
|
||||||
"(" #arg "->type = %u)", arg->type); \
|
|
||||||
} \
|
} \
|
||||||
|
OXR_VERIFY_ARG_TYPE_CAN_BE_NULL(log, arg, type_enum); \
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
#define OXR_VERIFY_SUBACTION_PATHS(log, count, paths) \
|
#define OXR_VERIFY_SUBACTION_PATHS(log, count, paths) \
|
||||||
|
|
Loading…
Reference in a new issue