svn commit: r321152 - stable/11/usr.bin/getconf

Ngie Cooper ngie at FreeBSD.org
Tue Jul 18 18:33:08 UTC 2017


Author: ngie
Date: Tue Jul 18 18:33:07 2017
New Revision: 321152
URL: https://svnweb.freebsd.org/changeset/base/321152

Log:
  MFC r318280:
  
  getconf: use nitems(..) to compute NWORDS instead of hardcoding
  the equivalent macro

Modified:
  stable/11/usr.bin/getconf/fake-gperf.awk
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/getconf/fake-gperf.awk
==============================================================================
--- stable/11/usr.bin/getconf/fake-gperf.awk	Tue Jul 18 18:33:05 2017	(r321151)
+++ stable/11/usr.bin/getconf/fake-gperf.awk	Tue Jul 18 18:33:07 2017	(r321152)
@@ -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-stable-11 mailing list