From df630de5e10c774ffc1671382016101920f1a072 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sun, 14 May 2017 20:39:01 +0000 Subject: [PATCH] getconf: use nitems(..) to compute NWORDS instead of hardcoding the equivalent macro MFC after: 1 month Sponsored by: Dell EMC Isilon --- usr.bin/getconf/fake-gperf.awk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.bin/getconf/fake-gperf.awk b/usr.bin/getconf/fake-gperf.awk index 96fcd3c9977..d56ec014145 100644 --- a/usr.bin/getconf/fake-gperf.awk +++ b/usr.bin/getconf/fake-gperf.awk @@ -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 "; + print "#define\tNWORDS\t(nitems(wordlist) - 1)"; print "static const struct map *"; print "in_word_set(const char *word)"; print "{";