From nobody Wed Jun 28 22:20:03 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 4Qrwxb5zt0z4kZVr; Wed, 28 Jun 2023 22:20:03 +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 4Qrwxb32m0z4HBb; Wed, 28 Jun 2023 22:20:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687990803; 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=cujgUIUHQKzXpdHbapVpLAhtteifNM7ePWaUzjCGYd0=; b=LBnzP9XQiC9MmUDUqDETCj8tdLYW36kozz18K9jaQPRqkEIhpBosYusON9VhfcjQtYGYis PywKHiPFlErc7eQijM9ez/XNpeIXodWbwkrKg91CBu4iR3f4BDL8qMKFc6oQO516HiWJWG xwOxEkxCIEBLWig9c9ClT7WqdvmaIFrboXHUvBmSJNK/gxbCDlIGZ/Fethur8yJsnCP0Nl Ug1AbkSWgNUlMoZpWiD2zjnF6sYDZKAculWgKiuUNzZEU/iXKNj/nA7GyYGB1QufI0UhLr 8w3hRatRehNxDHzAQ5tnxho27Dy8w8CNOD9gzbCy/Z6aGM6tMQpiq2Li+z+rWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687990803; 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=cujgUIUHQKzXpdHbapVpLAhtteifNM7ePWaUzjCGYd0=; b=k1oYl0dQhFVBBfX4UkS/m0iKLeGiLoN+Q/S6fnYwkNqfdW+pVVCgFBO7yOyuApkJf+cP/+ T884nTxDT2Hq0EPcRSfGvSC1cOre0FiZMNbdnVDC+IyMt2/OvNFEYRNRZ6lDWjDoOaQOjd 2ygJxNLzJqljeQEFpPJYNMH8lzGmLgbqykq/ltj+PYD3r7XHJjyakkXd0KWNkeMmxRLp05 EuDmKtTy55Y7FyojKxbHsowX8OMkTwTjTkJD5WEPK4w1zk7F+lKDKTUq2vE9xovSvxTt5C lDTcOYmfp0XkSskfeoutTyf+FZL/ocflItqR5Ki0Mj0voS/lserqs3e/ABQlaw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1687990803; a=rsa-sha256; cv=none; b=OWfbY6nxuZjPo42XmmoO8eSyum6VdVbWp3/tvuRMeJApe2kNtdcxTUXgErN31ruhJgVZ3L LQtsF7IhPRrxbg6sR5gUvqt1U0F/vDHwTDxMvLvxRCd/OVJLKd/ELgM9VWO/Y5iSlBQK/B Y6y1XPTVI5E8B2gFWz2m5t/VM28QnZliI17/s+LjkSigbj98SScEkHMhiB4A78RoNXogr9 oxJhOxh2dhldiyUHhArVgzIIWMhcy7lNs67AMtBRDCAAX09oKWFbESwmgloFSlMZcYBPpZ jIoQzDSRILdt3o5vG7Ouqm9O/HwBlK0HEvdzPnBubQROnrtT/x62ZAiX09ew6g== 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 4Qrwxb1sJtzrHq; Wed, 28 Jun 2023 22:20:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 35SMK3jL010590; Wed, 28 Jun 2023 22:20:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35SMK3RA010588; Wed, 28 Jun 2023 22:20:03 GMT (envelope-from git) Date: Wed, 28 Jun 2023 22:20:03 GMT Message-Id: <202306282220.35SMK3RA010588@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 430168942f2b - main - newfs: prefer unsigned index over signed 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 430168942f2bf68b0230906a658a0ceb7acceef2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=430168942f2bf68b0230906a658a0ceb7acceef2 commit 430168942f2bf68b0230906a658a0ceb7acceef2 Author: Alfonso Gregory AuthorDate: 2023-06-28 22:14:07 +0000 Commit: Warner Losh CommitDate: 2023-06-28 22:18:47 +0000 newfs: prefer unsigned index over signed We can just use a for loop starting at 0 instead of a while loop starting at -1. Reviewed by: imp, mckusick Pull Request: https://github.com/freebsd/freebsd-src/pull/733 --- sbin/newfs/newfs.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index a2d97131d3a7..2dbd27ce2a0f 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -137,7 +137,8 @@ main(int argc, char *argv[]) struct stat st; char *cp, *special; intmax_t reserved; - int ch, i, rval; + int ch, rval; + size_t i; char part_name; /* partition name, default to full disk */ part_name = 'c'; @@ -153,9 +154,10 @@ main(int argc, char *argv[]) break; case 'L': volumelabel = optarg; - i = -1; - while (isalnum(volumelabel[++i]) || - volumelabel[i] == '_' || volumelabel[i] == '-'); + for (i = 0; isalnum(volumelabel[i]) || + volumelabel[i] == '_' || volumelabel[i] == '-'; + i++) + continue; if (volumelabel[i] != '\0') { errx(1, "bad volume label. Valid characters " "are alphanumerics, dashes, and underscores.");