From: Andrew Cooper Date: Tue, 29 Sep 2020 17:39:08 +0000 (+0100) Subject: tools/libxl: Simplify DOMCTL_CDF_ flags handling in libxl__domain_make() X-Git-Tag: archive/raspbian/4.16.0+51-g0941d6cb-1+rpi1~2^2~42^2~1550 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=346b11561906840e29ca82d5569a51f6668d3a6a;p=xen.git tools/libxl: Simplify DOMCTL_CDF_ flags handling in libxl__domain_make() 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. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Roger Pau Monné Acked-by: Wei Liu --- diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c index 9a6e92b3a5..df31a42124 100644 --- a/tools/libs/light/libxl_create.c +++ b/tools/libs/light/libxl_create.c @@ -611,10 +611,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);