From 346b11561906840e29ca82d5569a51f6668d3a6a Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Tue, 29 Sep 2020 18:39:08 +0100 Subject: [PATCH] tools/libxl: Simplify DOMCTL_CDF_ flags handling in libxl__domain_make() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- tools/libs/light/libxl_create.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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); -- 2.30.2