aboutsummaryrefslogtreecommitdiff
path: root/sbin/ifconfig
diff options
context:
space:
mode:
authorRyan Moeller <freqlabs@FreeBSD.org>2021-02-28 02:08:43 +0000
committerRyan Moeller <freqlabs@FreeBSD.org>2021-03-05 09:15:55 +0000
commit88832d59dec10e97dd64b44391606776b20e782b (patch)
tree3a71e7b5de6612798c198d21ec215ba71e9a87a6 /sbin/ifconfig
parent2803fa471e77dc8f227fe00bbf075de7feb10022 (diff)
downloadsrc-88832d59dec10e97dd64b44391606776b20e782b.tar.gz
src-88832d59dec10e97dd64b44391606776b20e782b.zip
sbin/ifconfig: Minor housekeeping
Coalesce adjacent lint ifdefs. Fix spelling of nitems. Reviewed by: kp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29022
Diffstat (limited to 'sbin/ifconfig')
-rw-r--r--sbin/ifconfig/ifconfig.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index fc5351bd420e..5e114b43c126 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
@@ -215,8 +212,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)
{
@@ -246,7 +241,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;
}
@@ -297,8 +292,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]);
}
@@ -347,8 +341,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 *),