X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Foptional.h;h=0d99fe3224f4e419679d22627a0f4899f0c2a9d2;hp=05f6054dade7c0a8fecbf20b5ef0bb5de1023807;hb=3da864a94ccc39239fea82c4803b58b6b56a1003;hpb=894e6e1c66b3b7288c3cfca2a6f9d916774d6dea;ds=sidebyside diff --git a/src/common/optional.h b/src/common/optional.h index 05f6054da..0d99fe322 100644 --- a/src/common/optional.h +++ b/src/common/optional.h @@ -67,6 +67,17 @@ (optional).value; \ }) +/* + * This macro is available as a 'convenience' to allow sites that assume + * an optional value is set to assert() that it is set when fecthing the + * underlying value's address. + */ +#define LTTNG_OPTIONAL_GET_PTR(optional) \ + ({ \ + assert((optional).is_set); \ + &(optional).value; \ + }) + /* * Initialize an optional field. *