From: Kevin Wolf <kwolf@redhat.com>
To: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
Cc: richard.henderson@linaro.org, philmd@redhat.com, qemu-devel@nongnu.org
Subject: Re: [PATCH] qemu-io-cmds: Simplify help_oneline
Date: Mon, 28 Sep 2020 15:18:21 +0200 [thread overview]
Message-ID: <20200928131821.GG5451@linux.fritz.box> (raw)
In-Reply-To: <20200824102914.105619-1-dgilbert@redhat.com>
Am 24.08.2020 um 12:29 hat Dr. David Alan Gilbert (git) geschrieben:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> help_oneline is declared and starts as:
>
> static void help_oneline(const char *cmd, const cmdinfo_t *ct)
> {
> if (cmd) {
> printf("%s ", cmd);
> } else {
> printf("%s ", ct->name);
> if (ct->altname) {
> printf("(or %s) ", ct->altname);
> }
> }
>
> However, there are only two routes to help_oneline being called:
>
> help_f -> help_all -> help_oneline(ct->name, ct)
>
> help_f -> help_onecmd(argv[1], ct)
>
> In the first case, 'cmd' and 'ct->name' are the same thing,
> so it's impossible for the if (cmd) to be false and then validly
> print ct->name - this is upsetting gcc
> ( https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96739 )
>
> In the second case, cmd is argv[1] and we know we've got argv[1]
> so again (cmd) is non-NULL.
>
> Simplify help_oneline by just printing cmd.
> (Also strengthen argc check just to be pedantic)
>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Thanks, applied to the block branch.
Kevin
prev parent reply other threads:[~2020-09-28 13:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-24 10:29 [PATCH] qemu-io-cmds: Simplify help_oneline Dr. David Alan Gilbert (git)
2020-09-28 13:18 ` Kevin Wolf [this message]
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=20200928131821.GG5451@linux.fritz.box \
--to=kwolf@redhat.com \
--cc=dgilbert@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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 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.