Re: Simplify procargs

Herbert Xu <[email protected]> Sun, 31 Aug 2025 16:45:51 +0800
Newsgroups org.kernel.vger.dash
Message-ID <[email protected]>
Denys Vlasenko <[email protected]> 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 <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt