On Fri, Oct 23, 2020 at 2:08 PM Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote: > > On Fri, Oct 23, 2020 at 3:06 PM Andy Shevchenko > <andy.shevchenko@xxxxxxxxx> wrote: > > On Fri, Oct 23, 2020 at 2:39 PM Bartosz Golaszewski <brgl@xxxxxxxx> wrote: > > > On Fri, Oct 23, 2020 at 12:24 PM Andy Shevchenko > > > <andy.shevchenko@xxxxxxxxx> wrote: > > ... > > > > Nope because gcc will scream: > > > > > > error: flexible array member in union > > > > Ah, of course. Should be > > struct ... **lines; > > But it is not gonna work... we need an array here. or just one member > > struct *lines; > > bulk: > lines = malloc(num_lines * sizeof(lines)); > xxx->lines = lines; > > single: > xxx->lines = line; > The definition I used is clearer - it's explicit about using an array with a single member by default and can be extended as needed when allocating. Bartosz