svn commit: r298169 - head/usr.bin/locale
Baptiste Daroussin
bapt at FreeBSD.org
Sun Apr 17 22:42:49 UTC 2016
Author: bapt
Date: Sun Apr 17 22:42:48 2016
New Revision: 298169
URL: https://svnweb.freebsd.org/changeset/base/298169
Log:
Use the nitems() macro
Modified:
head/usr.bin/locale/locale.c
Modified: head/usr.bin/locale/locale.c
==============================================================================
--- head/usr.bin/locale/locale.c Sun Apr 17 21:59:04 2016 (r298168)
+++ head/usr.bin/locale/locale.c Sun Apr 17 22:42:48 2016 (r298169)
@@ -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);
More information about the svn-src-head
mailing list