Skip to content

Commit

Permalink
rtadvctl: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Browse files Browse the repository at this point in the history
Pull Request: #888
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
  • Loading branch information
ElyesH authored and bsdimp committed Apr 29, 2024
1 parent 93e96d6 commit d1d652c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions usr.sbin/rtadvctl/rtadvctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -137,7 +137,7 @@ usage(void)
{
int i;

for (i = 0; (size_t)i < sizeof(dtable)/sizeof(dtable[0]); i++) {
for (i = 0; (size_t)i < nitems(dtable); i++) {
if (dtable[i].dt_comm == NULL)
break;
printf("%s\n", dtable[i].dt_comm);
Expand Down Expand Up @@ -172,7 +172,7 @@ main(int argc, char *argv[])
if (argc == 0)
usage();

for (i = 0; (size_t)i < sizeof(dtable)/sizeof(dtable[0]); i++) {
for (i = 0; (size_t)i < nitems(dtable); i++) {
if (dtable[i].dt_comm == NULL ||
strcmp(dtable[i].dt_comm, argv[0]) == 0) {
action = dtable[i].dt_act;
Expand Down

0 comments on commit d1d652c

Please sign in to comment.