From: Jan Beulich Date: Fri, 13 Aug 2021 14:50:09 +0000 (+0200) Subject: libxc: simplify HYPERCALL_BUFFER() X-Git-Tag: archive/raspbian/4.16.0+51-g0941d6cb-1+rpi1~2^2~42^2~289 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=5c34b9af05b9e5abd25d88efc4fb783136547810;p=xen.git libxc: simplify HYPERCALL_BUFFER() _hcbuf_buf1 has been there only for a pointer comparison to validate type compatibility. The same can be achieved by not using typeof() on the definition of what so far was _hcbuf_buf2, as the initializer has to also be type-compatible. Drop _hcbuf_buf1 and the comaprison; rename _hcbuf_buf2. Since we're already using compiler extensions here, don't be shy and also omit the middle operand of the involved ?: operator. Bring line continuation character placement in line with that of related macros. Signed-off-by: Jan Beulich Acked-by: Andrew Cooper --- diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h index 14adaa0c10..b77726eab7 100644 --- a/tools/include/xenctrl.h +++ b/tools/include/xenctrl.h @@ -247,13 +247,10 @@ typedef struct xc_hypercall_buffer xc_hypercall_buffer_t; /* * Returns the hypercall_buffer associated with a variable. */ -#define HYPERCALL_BUFFER(_name) \ - ({ xc_hypercall_buffer_t _hcbuf_buf1; \ - typeof(XC__HYPERCALL_BUFFER_NAME(_name)) *_hcbuf_buf2 = \ - &XC__HYPERCALL_BUFFER_NAME(_name); \ - (void)(&_hcbuf_buf1 == _hcbuf_buf2); \ - (_hcbuf_buf2)->param_shadow ? \ - (_hcbuf_buf2)->param_shadow : (_hcbuf_buf2); \ +#define HYPERCALL_BUFFER(_name) \ + ({ xc_hypercall_buffer_t *_hcbuf_buf = \ + &XC__HYPERCALL_BUFFER_NAME(_name); \ + _hcbuf_buf->param_shadow ?: _hcbuf_buf; \ }) #define HYPERCALL_BUFFER_INIT_NO_BOUNCE .dir = 0, .sz = 0, .ubuf = (void *)-1