Re: [libgpiod][RFC/RFT 06/18] bindings: glib: add examples

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

 



On Mon, May 27, 2024 at 9:51 PM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> On Fri, May 24, 2024 at 08:22:05PM +0200, Bartosz Golaszewski wrote:
> > On Tue, Apr 23, 2024 at 8:23 PM Andy Shevchenko
> > <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> > > On Fri, Apr 12, 2024 at 02:27:52PM +0200, Bartosz Golaszewski wrote:
> > > > From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
>
> ...
>
> > > > +     ret = g_gpiod_line_request_set_value(data->request, data->line_offset,
> > > > +                                          data->value, &err);
> > > > +     if (!ret) {
> > >
> > > ret == 0 equals error?!
> >
> > It returns gboolean where false means error. This is a pattern in GLib.
>
> For booleans we have a pattern like
>
>         if (bool_func(...))
>
> to imply it.
>
>         ret = int_func(...);
>         if (ret) // if (!ret)
>
> kinda implies int. Does Glib has that type of pattern?
>
> > > > +             g_printerr("failed to set line value: %s\n", err->message);
> > > > +             exit(EXIT_FAILURE);
> > >
> > > Don't you have something like err->code to propagate?
> >
> > What for? err->message is the human-readable string of the error.
>
> If somebody wants to parse this with a script?
>

Andy: these are just examples. The user of the library is free to
print the GError contents however they wish. The main point of
interest in this huge series is the DBus API because it will have to
be carved in stone, anything else is just implementation details.

I am always grateful for your thorough reviews but I don't want to
bikeshed over example code at this point, let's use that energy where
it's needed right now and revisit the implementation at a later time.

Bart





[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