Date: Sun, 14 May 2017 20:39:01 +0000 (UTC) From: Ngie Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r318280 - head/usr.bin/getconf Message-ID: <201705142039.v4EKd1MQ019388@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 "{";
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705142039.v4EKd1MQ019388>