The use of the ternary operator serves only to obfuscate the code. Rewrite it in more simple terms, avoiding the need to conditionally OR zero into the flags.
Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com> --- CC: Ian Jackson <i...@xenproject.org> CC: Wei Liu <w...@xen.org> CC: Anthony PERARD <anthony.per...@citrix.com> --- tools/libxl/libxl_create.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 1031b75159..ed671052d7 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -612,10 +612,12 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config, if (info->type != LIBXL_DOMAIN_TYPE_PV) { create.flags |= XEN_DOMCTL_CDF_hvm; - create.flags |= - libxl_defbool_val(info->hap) ? XEN_DOMCTL_CDF_hap : 0; - create.flags |= - libxl_defbool_val(info->oos) ? 0 : XEN_DOMCTL_CDF_oos_off; + + if ( libxl_defbool_val(info->hap) ) + create.flags |= XEN_DOMCTL_CDF_hap; + + if ( !libxl_defbool_val(info->oos) ) + create.flags |= XEN_DOMCTL_CDF_oos_off; } assert(info->passthrough != LIBXL_PASSTHROUGH_DEFAULT); -- 2.11.0