From nobody Thu Jul 13 05:24:11 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4R1jhW3gt3z4mj83; Thu, 13 Jul 2023 05:24:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4R1jhW3Clrz3mCK; Thu, 13 Jul 2023 05:24:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689225851; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xXtYk7ACadyI9P30liHLcmcUMuLR8iMfE9EWcQFOJ+g=; b=uPPs1oZINoPLr5bN3rML9pLpEWyVXU04GvRUwo+DXOQbJWQTRtSv10ORxQ38cugRb/0Z6S nJ3FWDayE7T06IBt2NwbJdKhrQ5ZMnqHSuctpE+TAJ4AUxVjAnFSXee1fjs2cRCmSNBjea RcTfDAvF8csb0dxNyOz9XqUBsyX1P8GJ9S/tmIjIsxJWSdE3+mWZ7IxbBtaXV8XnMdQ+Dv dKNDz/2wkw/PiUU3T8WNkssHE3z1zTR9CdkKfW9NJNxMgrlizNW8R/lAhTnuVDrAX5Swt8 m1fxg543w0KjC6rLgjs/ful3GWd03/WgwgytV4wDtUipn6dswRNGyOj7+3QyFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689225851; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xXtYk7ACadyI9P30liHLcmcUMuLR8iMfE9EWcQFOJ+g=; b=b9fwZzeV17IJDHcxQs4eMAqs6xJm9DN1oGrTaI7uHGXHoJx76x0l8GLQxmh0MW5jCm4Dbn l6csVa7nSpNUyyi21ATC5wd57foG8nQG1zZdvUoPBzV78o6RTteaBwNiESmCheStnH6/tN 3s+xT+XZGguN0xlayESS94rYKLE+DUFKbtqMmMzeNuBaoY5CgrSGOQizqC8J4XCcAknXpd vSjMlV/UBVbXLQKbupzntptr4BCf/BND4e6lSAFQB50nQw3GguE+Qcsjx4H4JKSnbtKF3P 5oZ3HIfWPgMzq+Ost4PrMXVhOz2epefMiJM5rn9h8pTEsgxLAIUnMdlreVYEng== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1689225851; a=rsa-sha256; cv=none; b=MDet2/iU31X1eIXDPLPWacjy7Td2nfKOOoUwvzV9xUCEzA/AA0lw49qzhL1iYei51YXdOc xAWrkoru2I3DcKrL3DkhFcPWyTNg1REkYkQAl/Sl897A5825vIunrcZL8y5STSh+gs5xW8 3b2BZFR1ioncszNhJZBChg4UzEPZf0aCMeiQcMx/smebqhXTCuFGGVnEJ/vUKy0cTIrR1/ e470ApXZCg74mHQKYlOpkHr1R1Z5OVEmieXZ+4+h7Pb6FioGVUnQcBrW56ykn6N7eoW6lG OMH4pWPFDtYvwRV0OGGr6zGBkgc/37lQxIOWHFQg/cORiZfC7MClCnX1dcxTEg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4R1jhW2J1Pzdn8; Thu, 13 Jul 2023 05:24:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 36D5OBl3018991; Thu, 13 Jul 2023 05:24:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 36D5OBNN018990; Thu, 13 Jul 2023 05:24:11 GMT (envelope-from git) Date: Thu, 13 Jul 2023 05:24:11 GMT Message-Id: <202307130524.36D5OBNN018990@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 9d843ba32496 - main - rpcgen: Clarify behaviour for idx List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9d843ba32496b5713eea53e9e06f09b9377e700e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=9d843ba32496b5713eea53e9e06f09b9377e700e commit 9d843ba32496b5713eea53e9e06f09b9377e700e Author: Jessica Clarke AuthorDate: 2023-07-13 05:22:52 +0000 Commit: Jessica Clarke 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); }