svn commit: r319970 - head/usr.sbin/ifmcstat
Marcelo Araujo
araujo at FreeBSD.org
Thu Jun 15 06:48:38 UTC 2017
Author: araujo
Date: Thu Jun 15 06:48:36 2017
New Revision: 319970
URL: https://svnweb.freebsd.org/changeset/base/319970
Log:
Use nitems() from sys/param.h.
MFC after: 4 weeks.
Modified:
head/usr.sbin/ifmcstat/ifmcstat.c
Modified: head/usr.sbin/ifmcstat/ifmcstat.c
==============================================================================
--- head/usr.sbin/ifmcstat/ifmcstat.c Thu Jun 15 06:46:40 2017 (r319969)
+++ head/usr.sbin/ifmcstat/ifmcstat.c Thu Jun 15 06:48:36 2017 (r319970)
@@ -805,7 +805,7 @@ inm_print_sources_sysctl(uint32_t ifindex, struct in_a
uint32_t fmode;
const char *modestr;
- mibsize = sizeof(mib) / sizeof(mib[0]);
+ mibsize = nitems(mib);
if (sysctlnametomib("net.inet.ip.mcast.filters", mib, &mibsize) == -1) {
perror("sysctlnametomib");
return;
@@ -814,7 +814,7 @@ inm_print_sources_sysctl(uint32_t ifindex, struct in_a
needed = 0;
mib[5] = ifindex;
mib[6] = gina.s_addr; /* 32 bits wide */
- mibsize = sizeof(mib) / sizeof(mib[0]);
+ mibsize = nitems(mib);
do {
if (sysctl(mib, mibsize, NULL, &needed, NULL, 0) == -1) {
perror("sysctl net.inet.ip.mcast.filters");
@@ -905,7 +905,7 @@ in6m_print_sources_sysctl(uint32_t ifindex, struct in6
uint32_t fmode;
const char *modestr;
- mibsize = sizeof(mib) / sizeof(mib[0]);
+ mibsize = nitems(mib);
if (sysctlnametomib("net.inet6.ip6.mcast.filters", mib,
&mibsize) == -1) {
perror("sysctlnametomib");
@@ -918,7 +918,7 @@ in6m_print_sources_sysctl(uint32_t ifindex, struct in6
for (i = 0; i < 4; i++)
mib[6 + i] = *pi++;
- mibsize = sizeof(mib) / sizeof(mib[0]);
+ mibsize = nitems(mib);
do {
if (sysctl(mib, mibsize, NULL, &needed, NULL, 0) == -1) {
perror("sysctl net.inet6.ip6.mcast.filters");
@@ -1145,7 +1145,7 @@ ifmcstat_getifmaddrs(void)
size_t mibsize, len;
int mib[5];
- mibsize = sizeof(mib) / sizeof(mib[0]);
+ mibsize = nitems(mib);
if (sysctlnametomib("net.inet.igmp.ifinfo",
mib, &mibsize) == -1) {
perror("sysctlnametomib");
@@ -1170,7 +1170,7 @@ ifmcstat_getifmaddrs(void)
size_t mibsize, len;
int mib[5];
- mibsize = sizeof(mib) / sizeof(mib[0]);
+ mibsize = nitems(mib);
if (sysctlnametomib("net.inet6.mld.ifinfo",
mib, &mibsize) == -1) {
perror("sysctlnametomib");
More information about the svn-src-all
mailing list