From: Kent Gibson <warthog618@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>,
Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH 5/5] gpio: uapi: clarify the meaning of 'empty' char arrays
Date: Mon, 5 Oct 2020 21:06:10 +0800 [thread overview]
Message-ID: <20201005130610.GA33067@sol> (raw)
In-Reply-To: <CAHp75VdJ7zqPtWXKp3cUqPw3ZT7K0Dxzf7NYK+Zk9ZBhAPqG4g@mail.gmail.com>
On Mon, Oct 05, 2020 at 02:01:22PM +0300, Andy Shevchenko wrote:
> On Mon, Oct 5, 2020 at 10:07 AM Kent Gibson <warthog618@gmail.com> wrote:
> >
> > Clarify that a char array containing a string is considered 'empty' if
> > the first character is the null terminator. The remaining characters
> > are not relevant to this determination.
>
> > * @label: a functional name for this GPIO chip, such as a product
> > - * number, may be empty
> > + * number, may be empty (i.e. label[0] == '\0')
>
> I would rather put it like
> "...may be empty string (i.e. label == "")"
>
I'm not keen on that alternative as what it suggests is actually a
pointer comparison, and even if the user realizes that they may instead
use "strlen(label) == 0", when they shouldn't be assuming that a null
terminator is present in the array. I avoided mentioning "string" and
kept it in terms of the char array for the same reason.
Cheers,
Kent.
next prev parent reply other threads:[~2020-10-05 13:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-05 7:03 [PATCH 0/5] gpio: uapi: documentation improvements Kent Gibson
2020-10-05 7:03 ` [PATCH 1/5] gpio: uapi: fix kernel-doc warnings Kent Gibson
2020-10-05 7:03 ` [PATCH 2/5] gpio: uapi: comment consistency Kent Gibson
2020-10-05 7:03 ` [PATCH 3/5] gpio: uapi: kernel-doc formatting improvements Kent Gibson
2020-10-05 7:03 ` [PATCH 4/5] gpio: uapi: remove whitespace Kent Gibson
2020-10-05 7:03 ` [PATCH 5/5] gpio: uapi: clarify the meaning of 'empty' char arrays Kent Gibson
2020-10-05 11:01 ` Andy Shevchenko
2020-10-05 13:06 ` Kent Gibson [this message]
2020-10-05 11:02 ` [PATCH 0/5] gpio: uapi: documentation improvements Andy Shevchenko
2020-10-05 11:02 ` Andy Shevchenko
2020-10-08 15:46 ` Bartosz Golaszewski
2020-10-13 13:21 ` Linus Walleij
2020-10-13 13:29 ` Kent Gibson
2020-10-14 17:14 ` Andy Shevchenko
2020-10-14 23:35 ` Kent Gibson
2020-10-19 13:05 ` Linus Walleij
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=20201005130610.GA33067@sol \
--to=warthog618@gmail.com \
--cc=andy.shevchenko@gmail.com \
--cc=bgolaszewski@baylibre.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).