All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Kent Gibson <warthog618@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>
Subject: Re: [libgpiod][PATCH 2/3] libgpiosim: new library for controlling the gpio-sim module
Date: Thu, 29 Apr 2021 20:00:14 +0300	[thread overview]
Message-ID: <YIrmHkaKnrr4IdCT@smile.fi.intel.com> (raw)
In-Reply-To: <CAMRc=MeKciVDxdFvq6_d8mN8M08tqDSc1qDqmywswF2gbUa=Dg@mail.gmail.com>

On Thu, Apr 29, 2021 at 03:07:49PM +0200, Bartosz Golaszewski wrote:
> On Thu, Apr 29, 2021 at 1:23 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Thu, Apr 29, 2021 at 11:47:33AM +0200, Bartosz Golaszewski wrote:

...

> > > +/* We don't have mkdtempat()... :( */
> >
> > But we have tmpnam() / tmpnam_r(), why to reinvent it below?
> >
> 
> Because of this:
> 
> $man tmpnam_r
> ...
> The created pathname has a directory prefix P_tmpdir.
> ...
> 
> And this:
> 
> ./stdio.h:120:# define P_tmpdir "/tmp"

Still you may advance the pointer by the length of P_tmpdir + 1.

...

> > > +     for (i = 0; i < num_names; i++)
> > > +             written += snprintf(buf + written, size - written,
> > > +                                 "\"%s\", ", names[i] ?: "");
> > > +     buf[size - 2] = '\0';
> >
> > Dunno if you can use asprintf() and actually replace NULL by "" in the original
> > array. Ah, see you already using it somewhere else, why not here?
> >
> 
> Not sure what you mean, we can't use asprintf() to create a composite
> string like what is needed here. Can you give me an example?

I have got this after sending. Either you need to create a format string with
va_args, or do it manually.


-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2021-04-29 17:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29  9:47 [libgpiod][PATCH 0/3] tests: add support for the gpio-sim kernel module Bartosz Golaszewski
2021-04-29  9:47 ` [libgpiod][PATCH 1/3] tests: remove gpiod_test_chip_num() Bartosz Golaszewski
2021-04-29  9:47 ` [libgpiod][PATCH 2/3] libgpiosim: new library for controlling the gpio-sim module Bartosz Golaszewski
2021-04-29 11:23   ` Andy Shevchenko
2021-04-29 13:07     ` Bartosz Golaszewski
2021-04-29 17:00       ` Andy Shevchenko [this message]
2021-04-29 17:03         ` Andy Shevchenko
2021-04-29 17:04           ` Andy Shevchenko
2021-04-30  9:29             ` Bartosz Golaszewski
2021-04-30 11:41               ` Andy Shevchenko
2021-04-30 12:31         ` Bartosz Golaszewski
2021-04-29  9:47 ` [libgpiod][PATCH 3/3] tests: port C tests to libgpiosim 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=YIrmHkaKnrr4IdCT@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=brgl@bgdev.pl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --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.