mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-14 20:37:06 +00:00
Use the nitems() macro
This commit is contained in:
parent
d9f0ce3190
commit
206541f231
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=298169
|
@ -35,7 +35,9 @@
|
|||
* nl_langinfo(CODESET).
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <dirent.h>
|
||||
#include <err.h>
|
||||
#include <locale.h>
|
||||
|
@ -79,7 +81,7 @@ struct _lcinfo {
|
|||
{ "LC_MONETARY", LC_MONETARY },
|
||||
{ "LC_MESSAGES", LC_MESSAGES }
|
||||
};
|
||||
#define NLCINFO (sizeof(lcinfo)/sizeof(lcinfo[0]))
|
||||
#define NLCINFO nitems(lcinfo)
|
||||
|
||||
/* ids for values not referenced by nl_langinfo() */
|
||||
#define KW_ZERO 10000
|
||||
|
@ -290,7 +292,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
} else {
|
||||
uint i;
|
||||
for (i = 0; i < sizeof (kwinfo) / sizeof (struct _kwinfo); i++)
|
||||
for (i = 0; i < nitems(kwinfo); i++)
|
||||
showdetails ((char *)kwinfo [i].name);
|
||||
}
|
||||
exit(0);
|
||||
|
|
Loading…
Reference in a new issue