From: Herbert Xu <herbert@gondor.apana.org.au>
To: Denys Vlasenko <vda.linux@googlemail.com>
Cc: dash@vger.kernel.org
Subject: Re: Simplify procargs
Date: Sun, 31 Aug 2025 16:45:51 +0800 [thread overview]
Message-ID: <aLQLv0lvv0baMEeY@gondor.apana.org.au> (raw)
In-Reply-To: <CAK1hOcPiN8HPDR-Y-w+GXVa9gZNwHuahV=g=CJ_oOM-KQW1tiA@mail.gmail.com>
Denys Vlasenko <vda.linux@googlemail.com> wrote:
>
> procargs(int argc, char **argv)
>
> argc is used in just one place:
> if (argc > 0)
> xargv++;
>
> Trivially replaceable by if(xargv[0] != NULL), so can avoid passing
> this argument.
>
> char **xargv;
> xargv = argv;
>
> xargv is always equal to argv, so why having a separate variable?
>
> const char *xminusc;
> xminusc = minusc;
>
> Similar situation with xminusc being equal to minusc
> during the range where it is live, they diverge here:
>
> if (xminusc) {
> minusc = *xargv++;
>
> but after this, xminusc is not used.
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
prev parent reply other threads:[~2025-08-31 8:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-03 16:15 Simplify procargs Denys Vlasenko
2025-08-31 8:45 ` Herbert Xu [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=aLQLv0lvv0baMEeY@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=dash@vger.kernel.org \
--cc=vda.linux@googlemail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox