From owner-dev-commits-src-all@freebsd.org Sun Mar 14 09:09:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F8CA578664; Sun, 14 Mar 2021 09:09:47 +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 4DytzZ49FMz3FnS; Sun, 14 Mar 2021 09:09:46 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B6F561AAF3; Sun, 14 Mar 2021 09:09:45 +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 12E99jeO078315; Sun, 14 Mar 2021 09:09:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12E99jFd078314; Sun, 14 Mar 2021 09:09:45 GMT (envelope-from git) Date: Sun, 14 Mar 2021 09:09:45 GMT Message-Id: <202103140909.12E99jFd078314@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: caab2f4c89ba - stable/13 - sbin/ifconfig: Minor housekeeping MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: caab2f4c89bae2c44dc056d82e445cc71c183406 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2021 09:09:47 -0000 The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=caab2f4c89bae2c44dc056d82e445cc71c183406 commit caab2f4c89bae2c44dc056d82e445cc71c183406 Author: Ryan Moeller AuthorDate: 2021-02-28 02:08:43 +0000 Commit: Ryan Moeller CommitDate: 2021-03-14 08:07:06 +0000 sbin/ifconfig: Minor housekeeping Coalesce adjacent lint ifdefs. Fix spelling of nitems. Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D29022 (cherry picked from commit 88832d59dec10e97dd64b44391606776b20e782b) --- sbin/ifconfig/ifconfig.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 451532246d40..c99602dd0d84 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -33,9 +33,6 @@ static const char copyright[] = "@(#) Copyright (c) 1983, 1993\n\ The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint #if 0 static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94"; #endif @@ -211,8 +208,6 @@ ioctl_ifcreate(int s, struct ifreq *ifr) } } -#define ORDERS_SIZE(x) sizeof(x) / sizeof(x[0]) - static int calcorders(struct ifaddrs *ifa, struct ifa_queue *q) { @@ -242,7 +237,7 @@ calcorders(struct ifaddrs *ifa, struct ifa_queue *q) if (ifa->ifa_addr) { af = ifa->ifa_addr->sa_family; - if (af < ORDERS_SIZE(cur->af_orders) && + if (af < nitems(cur->af_orders) && cur->af_orders[af] == 0) cur->af_orders[af] = ++ord; } @@ -293,8 +288,7 @@ cmpifaddrs(struct ifaddrs *a, struct ifaddrs *b, struct ifa_queue *q) af1 = a->ifa_addr->sa_family; af2 = b->ifa_addr->sa_family; - if (af1 < ORDERS_SIZE(e1->af_orders) && - af2 < ORDERS_SIZE(e1->af_orders)) + if (af1 < nitems(e1->af_orders) && af2 < nitems(e1->af_orders)) return (e1->af_orders[af1] - e1->af_orders[af2]); } @@ -343,8 +337,6 @@ static void setformat(char *input) free(formatstr); } -#undef ORDERS_SIZE - static struct ifaddrs * sortifaddrs(struct ifaddrs *list, int (*compare)(struct ifaddrs *, struct ifaddrs *, struct ifa_queue *),