From nobody Mon Oct 20 21:42:23 2025 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 4cr867696bz6DBJG; Mon, 20 Oct 2025 21:42:23 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cr8675fQlz3YkL; Mon, 20 Oct 2025 21:42:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760996543; 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=w7+Nx6/4JfKr6wXWqlywmtCVxqm1AkFpnT8FaUJl53s=; b=Pe9sAw0hcgkJqTkVqvAL7gwhJs2k66xk3jVfH9wWnLc0bTFHMkHqTScnUDW3vUm5d2JOOG mZUg4lazha8TgvpEblZ6lZEsSPXj5pFRN323KbPqH0Cogkb8F4yl+GvdJrZE0Ilm+Iwf6J sizNgUECTH7woQzYrC5QDcR+NR9uzEbmiN/IKUo+hcsq+5PwtrV3sXeHUTneJBbuExWKLm Zey5NZSZ7RgTml5GggJQ5JJiHDYbTd9GrzzwUoNbvHLV+pl+o/zSjO/SHn1xosyGJyHyh3 jY6K0PhfTOYwlYAENZkhnGXBNbBKluyZuwSKykCiIOA+aLI4vZbNPKrp+OO/Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760996543; 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=w7+Nx6/4JfKr6wXWqlywmtCVxqm1AkFpnT8FaUJl53s=; b=gzLdZRIXK9mnWskC0KJctCoRIj21OjGGEO4h/vlf0czKaN/lJ94wIBB3137kB55Us5m47b 8e3gdQmmsMZXK28Z9fa5UgV0n+M/nxGw/U7L7biBPemuHAxMDipXTrPMkecF6q/JhaOg9E eW/rMvuXWscrjOB0MKvLPI6kBV+/F6E8puW4m+ibXYneMGHozOt98lTTFQg3zo0E+nXCR7 +N8WO5RgJaX932IN2XFZ01xflwZeepguwLHMbH2eY2X3fTfD85BUyw3CTayabs1kIUH3rF 4KHjMUO65LF5wVYaOjSndSXY7HbwTbPE+sQ/Z0+1hU6ELknNRnQdeJMts0l7Rg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1760996543; a=rsa-sha256; cv=none; b=YGKB/Iro/9JncvEjbKbb+bM/7T/SF4D+ondlBg3ptIz/caY/tKLqADT2nFVqmeHnwPg6qp wjmbbL0lCZ9IW03P5zDA+lQhYBBid2UJY/PordVZEH0tAEAuDu/Dbv8lWCzc9O58AKAoUE j25YKZMOygYXHaNKv9SoqFwY5fWpP+sPQblDeKnOEUZmD1Aqtf+hmBEigzzmV1Cy5HrAEI mA1nY62SCtySdzTefaj7FY909fnQzuWmf0cmV/TZtgo13Rx6B1JqBGu+Kmv8MnCWq3dH4V XEpVff6thB9h331Bluoaf4XQOLdRZAXVMJ0+NtIuhMgDPvJ9XzZypD/fvq0Lug== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4cr8675ClwzWn3; Mon, 20 Oct 2025 21:42:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 59KLgNdF065637; Mon, 20 Oct 2025 21:42:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 59KLgNoW065634; Mon, 20 Oct 2025 21:42:23 GMT (envelope-from git) Date: Mon, 20 Oct 2025 21:42:23 GMT Message-Id: <202510202142.59KLgNoW065634@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: fa347930f89d - main - quot: Make nusers unsigned 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fa347930f89d4f9d1956573c3bd4b5987127bc12 Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=fa347930f89d4f9d1956573c3bd4b5987127bc12 commit fa347930f89d4f9d1956573c3bd4b5987127bc12 Author: Dag-Erling Smørgrav AuthorDate: 2025-10-20 21:41:53 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-10-20 21:42:13 +0000 quot: Make nusers unsigned Fixes: 195b00ec45e5 ("quot: Clean up") Reviewed by: rlibby Differential Revision: https://reviews.freebsd.org/D53224 --- usr.sbin/quot/quot.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/usr.sbin/quot/quot.c b/usr.sbin/quot/quot.c index 879580f649b9..5dda36ac8499 100644 --- a/usr.sbin/quot/quot.c +++ b/usr.sbin/quot/quot.c @@ -178,20 +178,20 @@ static struct user { daddr_t spc60; daddr_t spc90; } *users; -static int nusers; +static unsigned int nusers; static void inituser(void) { - int i; struct user *usr; + unsigned int i; if (nusers == 0) { nusers = 8; if ((users = calloc(nusers, sizeof(*users))) == NULL) errx(1, "allocate users"); } else { - for (usr = users, i = nusers; --i >= 0; usr++) { + for (usr = users, i = nusers; i-- > 0; usr++) { usr->space = usr->spc30 = usr->spc60 = usr->spc90 = 0; usr->count = 0; } @@ -201,15 +201,15 @@ inituser(void) static void usrrehash(void) { - int i; struct user *usr, *usrn; struct user *svusr; + unsigned int i; svusr = users; nusers *= 2; if ((users = calloc(nusers, sizeof(*users))) == NULL) errx(1, "allocate users"); - for (usr = svusr, i = nusers / 2; --i >= 0; usr++) { + for (usr = svusr, i = nusers / 2; i-- > 0; usr++) { for (usrn = users + usr->uid % nusers; usrn->name; usrn--) { if (usrn <= users) usrn += nusers; @@ -223,10 +223,10 @@ user(uid_t uid) { struct user *usr; struct passwd *pwd; - int i; + unsigned int i; while (1) { - for (usr = users + uid % nusers, i = nusers; --i >= 0; usr--) { + for (usr = users + uid % nusers, i = nusers; i-- > 0; usr--) { if (usr->name == NULL) { usr->uid = uid; if (noname || (pwd = getpwuid(uid)) == NULL) @@ -280,7 +280,7 @@ uses(uid_t uid, daddr_t blks, time_t act) usr->spc30 += blks; } -#define FSZCNT 512 +#define FSZCNT 512U static struct fsizes { struct fsizes *fsz_next; daddr_t fsz_first, fsz_last; @@ -292,10 +292,10 @@ static void initfsizes(void) { struct fsizes *fp; - int i; + unsigned int i; for (fp = fsizes; fp; fp = fp->fsz_next) { - for (i = FSZCNT; --i >= 0;) { + for (i = FSZCNT; i-- > 0;) { fp->fsz_count[i] = 0; fp->fsz_sz[i] = 0; } @@ -309,13 +309,12 @@ dofsizes(int fd, struct fs *super) union dinode *dp; daddr_t sz, ksz; struct fsizes *fp, **fsp; - int i; + unsigned int i; maxino = super->fs_ncg * super->fs_ipg - 1; for (inode = 0; inode < maxino; inode++) { if ((dp = get_inode(fd, super, inode)) != NULL && - !isfree(super, dp) - ) { + !isfree(super, dp)) { sz = DIP(super, dp, di_blocks); ksz = SIZE(sz); for (fsp = &fsizes; (fp = *fsp); fsp = &fp->fsz_next) { @@ -329,7 +328,7 @@ dofsizes(int fd, struct fs *super) *fsp = fp; fp->fsz_first = rounddown(ksz, FSZCNT); fp->fsz_last = fp->fsz_first + FSZCNT; - for (i = FSZCNT; --i >= 0;) { + for (i = FSZCNT; i-- > 0;) { fp->fsz_count[i] = 0; fp->fsz_sz[i] = 0; }