Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Jul 2017 18:33:05 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r321151 - stable/10/usr.bin/getconf
Message-ID:  <201707181833.v6IIX59D085897@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Tue Jul 18 18:33:05 2017
New Revision: 321151
URL: https://svnweb.freebsd.org/changeset/base/321151

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

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

Modified: stable/10/usr.bin/getconf/fake-gperf.awk
==============================================================================
--- stable/10/usr.bin/getconf/fake-gperf.awk	Tue Jul 18 18:23:56 2017	(r321150)
+++ stable/10/usr.bin/getconf/fake-gperf.awk	Tue Jul 18 18:33:05 2017	(r321151)
@@ -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 "{";



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707181833.v6IIX59D085897>