mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-13 05:41:26 +01:00
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>
This commit is contained in:
parent
fdbf7cab91
commit
93e96d6c87
@ -27,8 +27,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/param.h>
|
||||||
#include <sys/queue.h>
|
#include <sys/queue.h>
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
@ -75,7 +75,7 @@ cm_recv(int fd, char *buf)
|
|||||||
pfds[0].events = POLLIN;
|
pfds[0].events = POLLIN;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
i = poll(pfds, sizeof(pfds)/sizeof(pfds[0]),
|
i = poll(pfds, nitems(pfds),
|
||||||
CM_RECV_TIMEOUT);
|
CM_RECV_TIMEOUT);
|
||||||
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
@ -131,7 +131,7 @@ cm_recv(int fd, char *buf)
|
|||||||
msglen);
|
msglen);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
i = poll(pfds, sizeof(pfds)/sizeof(pfds[0]),
|
i = poll(pfds, nitems(pfds),
|
||||||
CM_RECV_TIMEOUT);
|
CM_RECV_TIMEOUT);
|
||||||
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
|
@ -27,8 +27,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/param.h>
|
||||||
#include <sys/queue.h>
|
#include <sys/queue.h>
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
@ -527,7 +527,7 @@ cm_getprop(struct ctrl_msg_pl *cp)
|
|||||||
return (1);
|
return (1);
|
||||||
|
|
||||||
for (i = 0;
|
for (i = 0;
|
||||||
i < sizeof(getprop_dtable) / sizeof(getprop_dtable[0]);
|
i < nitems(getprop_dtable);
|
||||||
i++) {
|
i++) {
|
||||||
if (strcmp(cp->cp_key, getprop_dtable[i].dt_comm) == 0)
|
if (strcmp(cp->cp_key, getprop_dtable[i].dt_comm) == 0)
|
||||||
return (getprop_dtable[i].dt_act(cp));
|
return (getprop_dtable[i].dt_act(cp));
|
||||||
|
@ -642,7 +642,7 @@ getinet6sysctl(int code)
|
|||||||
|
|
||||||
mib[3] = code;
|
mib[3] = code;
|
||||||
size = sizeof(value);
|
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) {
|
< 0) {
|
||||||
syslog(LOG_ERR, "<%s>: failed to get ip6 sysctl(%d): %s",
|
syslog(LOG_ERR, "<%s>: failed to get ip6 sysctl(%d): %s",
|
||||||
__func__, code,
|
__func__, code,
|
||||||
|
@ -328,7 +328,7 @@ main(int argc, char *argv[])
|
|||||||
"<%s> there's no timer. waiting for inputs",
|
"<%s> there's no timer. waiting for inputs",
|
||||||
__func__);
|
__func__);
|
||||||
}
|
}
|
||||||
if ((i = poll(set, sizeof(set)/sizeof(set[0]),
|
if ((i = poll(set, nitems(set),
|
||||||
timeout ? (timeout->tv_sec * 1000 +
|
timeout ? (timeout->tv_sec * 1000 +
|
||||||
timeout->tv_nsec / 1000 / 1000) : INFTIM)) < 0) {
|
timeout->tv_nsec / 1000 / 1000) : INFTIM)) < 0) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user