|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] libxc: simplify HYPERCALL_BUFFER()
commit 5c34b9af05b9e5abd25d88efc4fb783136547810
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Fri Aug 13 16:50:09 2021 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Aug 13 16:50:09 2021 +0200
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 <jbeulich@xxxxxxxx>
Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
tools/include/xenctrl.h | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
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
--
generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |