Date: Thu, 15 Jun 2017 06:48:36 +0000 (UTC) From: Marcelo Araujo <araujo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r319970 - head/usr.sbin/ifmcstat Message-ID: <201706150648.v5F6majo019268@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706150648.v5F6majo019268>