Hi Jan
On 13.09.2019 17:35, Oleksandr Tyshchenko wrote:
--- a/xen/include/xen/xmalloc.h
+++ b/xen/include/xen/xmalloc.h
@@ -35,6 +35,15 @@
#define xzalloc_array(_type, _num) \
((_type *)_xzalloc_array(sizeof(_type), __alignof__(_type),
_num))
+/* Allocate space for a structure with a flexible array of typed
objects. */
+#define xmalloc_flex_struct(type, field, nr) \
+ (type *)_xmalloc(offsetof(type, field[nr]), __alignof__(type))
+
+/* Re-allocate space for a structure with a flexible array of typed
objects. */
+#define xrealloc_flex_struct(ptr, field,
nr) \
+ (typeof(ptr))_xrealloc(ptr, offsetof(typeof(*(ptr)),
field[nr]), \
+ __alignof__(typeof(*(ptr))))
With the missing parentheses around the entire constructs added
Reviewed-by: Jan Beulich <jbeul...@suse.com>
Thank you.
Would you be happy if I add xzalloc_flex_struct here as well (may I
retain your R-b)?
Actually the xzalloc_flex_struct better fits in [1] ...
[1]
https://www.mail-archive.com/xen-devel@lists.xenproject.org/msg55557.html
--
Regards,
Oleksandr Tyshchenko
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel