svn commit: r318280 - head/usr.bin/getconf

Ngie Cooper ngie at FreeBSD.org
Sun May 14 20:39:02 UTC 2017


Author: ngie
Date: Sun May 14 20:39:01 2017
New Revision: 318280
URL: https://svnweb.freebsd.org/changeset/base/318280

Log:
  getconf: use nitems(..) to compute NWORDS instead of hardcoding
  the equivalent macro
  
  MFC after: 	1 month
  Sponsored by:	Dell EMC Isilon

Modified:
  head/usr.bin/getconf/fake-gperf.awk

Modified: head/usr.bin/getconf/fake-gperf.awk
==============================================================================
--- head/usr.bin/getconf/fake-gperf.awk	Sun May 14 20:17:50 2017	(r318279)
+++ head/usr.bin/getconf/fake-gperf.awk	Sun May 14 20:39:01 2017	(r318280)
@@ -36,7 +36,8 @@ state == 1 { print; next; }
   state = 3;
   print "\t{ NULL, 0, 0 }";
   print "};";
-  print "#define\tNWORDS\t(sizeof(wordlist)/sizeof(wordlist[0]) - 1)";
+  print "#include <sys/param.h>";
+  print "#define\tNWORDS\t(nitems(wordlist) - 1)";
   print "static const struct map *";
   print "in_word_set(const char *word)";
   print "{";


More information about the svn-src-all mailing list