Re: [libgpiod][PATCH] treewide: rework struct gpiod_line_bulk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux