aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorElyes Haouas <ehaouas@noos.fr>2024-04-29 02:55:30 +0000
committerWarner Losh <imp@FreeBSD.org>2024-04-29 03:24:46 +0000
commit93e96d6c87dc8dd84cdfc56a155dc0611f55ac86 (patch)
tree59b636bd9c4c12269da5807721b8d8760292b013 /usr.sbin
parentfdbf7cab91ae9ae7ca87bd47acb7400813bd7160 (diff)
downloadsrc-93e96d6c87dc8dd84cdfc56a155dc0611f55ac86.tar.gz
src-93e96d6c87dc8dd84cdfc56a155dc0611f55ac86.zip
rtadvd: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888 Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/rtadvd/control.c6
-rw-r--r--usr.sbin/rtadvd/control_server.c4
-rw-r--r--usr.sbin/rtadvd/if.c2
-rw-r--r--usr.sbin/rtadvd/rtadvd.c2
4 files changed, 7 insertions, 7 deletions
diff --git a/usr.sbin/rtadvd/control.c b/usr.sbin/rtadvd/control.c
index 80af6371a269..54a944833f64 100644
--- a/usr.sbin/rtadvd/control.c
+++ b/usr.sbin/rtadvd/control.c
@@ -27,8 +27,8 @@
*
*/
+#include <sys/param.h>
#include <sys/queue.h>
-#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/un.h>
@@ -75,7 +75,7 @@ cm_recv(int fd, char *buf)
pfds[0].events = POLLIN;
for (;;) {
- i = poll(pfds, sizeof(pfds)/sizeof(pfds[0]),
+ i = poll(pfds, nitems(pfds),
CM_RECV_TIMEOUT);
if (i == 0)
@@ -131,7 +131,7 @@ cm_recv(int fd, char *buf)
msglen);
for (;;) {
- i = poll(pfds, sizeof(pfds)/sizeof(pfds[0]),
+ i = poll(pfds, nitems(pfds),
CM_RECV_TIMEOUT);
if (i == 0)
diff --git a/usr.sbin/rtadvd/control_server.c b/usr.sbin/rtadvd/control_server.c
index e96a1958dd10..60fdc5ca2ec0 100644
--- a/usr.sbin/rtadvd/control_server.c
+++ b/usr.sbin/rtadvd/control_server.c
@@ -27,8 +27,8 @@
*
*/
+#include <sys/param.h>
#include <sys/queue.h>
-#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/un.h>
@@ -527,7 +527,7 @@ cm_getprop(struct ctrl_msg_pl *cp)
return (1);
for (i = 0;
- i < sizeof(getprop_dtable) / sizeof(getprop_dtable[0]);
+ i < nitems(getprop_dtable);
i++) {
if (strcmp(cp->cp_key, getprop_dtable[i].dt_comm) == 0)
return (getprop_dtable[i].dt_act(cp));
diff --git a/usr.sbin/rtadvd/if.c b/usr.sbin/rtadvd/if.c
index 6212639ba028..e1702a0aa72a 100644
--- a/usr.sbin/rtadvd/if.c
+++ b/usr.sbin/rtadvd/if.c
@@ -642,7 +642,7 @@ getinet6sysctl(int code)
mib[3] = code;
size = sizeof(value);
- if (sysctl(mib, sizeof(mib)/sizeof(mib[0]), &value, &size, NULL, 0)
+ if (sysctl(mib, nitems(mib), &value, &size, NULL, 0)
< 0) {
syslog(LOG_ERR, "<%s>: failed to get ip6 sysctl(%d): %s",
__func__, code,
diff --git a/usr.sbin/rtadvd/rtadvd.c b/usr.sbin/rtadvd/rtadvd.c
index aa9038b65e63..fa5640afa96c 100644
--- a/usr.sbin/rtadvd/rtadvd.c
+++ b/usr.sbin/rtadvd/rtadvd.c
@@ -328,7 +328,7 @@ main(int argc, char *argv[])
"<%s> there's no timer. waiting for inputs",
__func__);
}
- if ((i = poll(set, sizeof(set)/sizeof(set[0]),
+ if ((i = poll(set, nitems(set),
timeout ? (timeout->tv_sec * 1000 +
timeout->tv_nsec / 1000 / 1000) : INFTIM)) < 0) {