git: 9d843ba32496 - main - rpcgen: Clarify behaviour for idx
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 13 Jul 2023 05:24:11 UTC
The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=9d843ba32496b5713eea53e9e06f09b9377e700e commit 9d843ba32496b5713eea53e9e06f09b9377e700e Author: Jessica Clarke <jrtc27@FreeBSD.org> AuthorDate: 2023-07-13 05:22:52 +0000 Commit: Jessica Clarke <jrtc27@FreeBSD.org> CommitDate: 2023-07-13 05:22:59 +0000 rpcgen: Clarify behaviour for idx The re-initialisation of idx in the later else branch is a bit hidden, and results in deviation from the earlier two paths. Use more consistent code instead to make it abundantly clear what's going on. --- usr.bin/rpcgen/rpc_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.bin/rpcgen/rpc_main.c b/usr.bin/rpcgen/rpc_main.c index 644c090f82ab..ba9eda676b39 100644 --- a/usr.bin/rpcgen/rpc_main.c +++ b/usr.bin/rpcgen/rpc_main.c @@ -270,18 +270,18 @@ add_warning(void) static void prepend_cpp(void) { - int idx = 1; + int idx = 0; const char *var; char *dupvar, *s, *t; if (CPP != NULL) - insarg(0, CPP); + insarg(idx++, CPP); else if ((var = getenv("RPCGEN_CPP")) == NULL) - insarg(0, "/usr/bin/cpp"); + insarg(idx++, "/usr/bin/cpp"); else { /* Parse command line in a rudimentary way */ dupvar = xstrdup(var); - for (s = dupvar, idx = 0; (t = strsep(&s, " \t")) != NULL; ) { + for (s = dupvar; (t = strsep(&s, " \t")) != NULL; ) { if (t[0]) insarg(idx++, t); }