Message ID | 20200930134248.4918-2-andrew.cooper3@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | x86: Untangle Nested virt and CPUID interactions | expand |
On Wed, Sep 30, 2020 at 02:42:41PM +0100, Andrew Cooper wrote: > 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.cooper3@citrix.com> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com> Might be worth adding to the log that it's a non-functional change. Thanks, Roger.
On Wed, Sep 30, 2020 at 02:42:41PM +0100, Andrew Cooper wrote: > 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.cooper3@citrix.com> Acked-by: Wei Liu <wl@xen.org>
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);
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.cooper3@citrix.com> --- CC: Ian Jackson <iwj@xenproject.org> CC: Wei Liu <wl@xen.org> CC: Anthony PERARD <anthony.perard@citrix.com> --- tools/libxl/libxl_create.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)