Re: [Xen-devel] [PATCH V3 4/8] xen/common: Introduce xrealloc_flex_struct() helper macros

2019-08-29 Thread Oleksandr
On 29.08.19 10:21, Jan Beulich wrote: Hi Jan On 28.08.2019 20:23, Oleksandr wrote: --- a/xen/include/xen/xmalloc.h +++ b/xen/include/xen/xmalloc.h @@ -35,6 +35,18 @@  #define xzalloc_array(_type, _num) \ ((_type *)_xzalloc_array(sizeof(_type), __alignof__(_type), _num)) +/*

Re: [Xen-devel] [PATCH V3 4/8] xen/common: Introduce xrealloc_flex_struct() helper macros

2019-08-29 Thread Jan Beulich
On 28.08.2019 20:23, Oleksandr wrote: > --- a/xen/include/xen/xmalloc.h > +++ b/xen/include/xen/xmalloc.h > @@ -35,6 +35,18 @@ >  #define xzalloc_array(_type, _num) \ > ((_type *)_xzalloc_array(sizeof(_type), __alignof__(_type), _num)) > > +/* Allocate space for a structure with a flexible

Re: [Xen-devel] [PATCH V3 4/8] xen/common: Introduce xrealloc_flex_struct() helper macros

2019-08-28 Thread Oleksandr
On 27.08.19 16:28, Jan Beulich wrote: Hi Jan On 20.08.2019 20:09, Oleksandr Tyshchenko wrote: --- a/xen/include/xen/xmalloc.h +++ b/xen/include/xen/xmalloc.h @@ -35,6 +35,18 @@   #define xzalloc_array(_type, _num) \   ((_type *)_xzalloc_array(sizeof(_type), __alignof__(_type), _num))  

Re: [Xen-devel] [PATCH V3 4/8] xen/common: Introduce xrealloc_flex_struct() helper macros

2019-08-27 Thread Jan Beulich
On 20.08.2019 20:09, Oleksandr Tyshchenko wrote: --- a/xen/include/xen/xmalloc.h +++ b/xen/include/xen/xmalloc.h @@ -35,6 +35,18 @@ #define xzalloc_array(_type, _num) \ ((_type *)_xzalloc_array(sizeof(_type), __alignof__(_type), _num)) +/* Re-allocate space for a structure with a

[Xen-devel] [PATCH V3 4/8] xen/common: Introduce xrealloc_flex_struct() helper macros

2019-08-20 Thread Oleksandr Tyshchenko
From: Oleksandr Tyshchenko This patch introduces type-safe helper macros to re-allocate space for a structure with a flexible array of typed objects. For example, if we need to re-size an array with a single element: struct arrlen { size_t len; int data[1]; }; We can use