mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-26 20:12:44 +00:00
rtadvctl: 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
93e96d6c87
commit
d1d652c060
@ -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>
|
||||
@ -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);
|
||||
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user