All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Bartosz Golaszewski <brgl@bgdev.pl>,
	Kent Gibson <warthog618@gmail.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Jack Winch <sunt.un.morcov@gmail.com>,
	Helmut Grohne <helmut.grohne@intenta.de>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>
Subject: Re: [libgpiod][PATCH] treewide: rework struct gpiod_line_bulk
Date: Fri, 23 Oct 2020 14:44:06 +0200	[thread overview]
Message-ID: <CAMpxmJWWt5MhqObJabOxtdm9U4rQ6EPvJR3PHBRH_J1uLMat+Q@mail.gmail.com> (raw)
In-Reply-To: <CAHp75VeGFuF7NrGJ9sc+kXz3e-wzGi3kTDmW56oaNKJf65NZLg@mail.gmail.com>

On Fri, Oct 23, 2020 at 2:08 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Fri, Oct 23, 2020 at 3:06 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> > On Fri, Oct 23, 2020 at 2:39 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> > > On Fri, Oct 23, 2020 at 12:24 PM Andy Shevchenko
> > > <andy.shevchenko@gmail.com> 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

  reply	other threads:[~2020-10-23 12:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-23  9:28 [libgpiod][PATCH] treewide: rework struct gpiod_line_bulk Bartosz Golaszewski
2020-10-23 10:24 ` Andy Shevchenko
2020-10-23 11:38   ` Bartosz Golaszewski
2020-10-23 12:06     ` Andy Shevchenko
2020-10-23 12:09       ` Andy Shevchenko
2020-10-23 12:44         ` Bartosz Golaszewski [this message]
2020-10-23 14:17           ` Andy Shevchenko
2020-10-23 15:14             ` Bartosz Golaszewski
2020-10-23 11:24 ` Kent Gibson
2020-10-24  8:01 ` Kent Gibson
2020-10-25 20:25   ` Bartosz Golaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMpxmJWWt5MhqObJabOxtdm9U4rQ6EPvJR3PHBRH_J1uLMat+Q@mail.gmail.com \
    --to=bgolaszewski@baylibre.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=brgl@bgdev.pl \
    --cc=geert@linux-m68k.org \
    --cc=helmut.grohne@intenta.de \
    --cc=linux-gpio@vger.kernel.org \
    --cc=sunt.un.morcov@gmail.com \
    --cc=warthog618@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.