From: Alejandro Colomar Date: Wed, 28 May 2025 11:52:12 +0000 (+0200) Subject: lib/getdef.c: Use countof() instead of its pattern X-Git-Tag: 4.18.0-rc1~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4e80ca87e7233d31d38eeb569e8682cc6051496e;p=thirdparty%2Fshadow.git lib/getdef.c: Use countof() instead of its pattern Signed-off-by: Alejandro Colomar --- diff --git a/lib/getdef.c b/lib/getdef.c index 9cc8bbfe5..84bc939b8 100644 --- a/lib/getdef.c +++ b/lib/getdef.c @@ -29,6 +29,7 @@ #include "getdef.h" #include "prototypes.h" #include "shadowlog_internal.h" +#include "sizeof.h" #include "string/sprintf/xasprintf.h" #include "string/strcmp/strcaseeq.h" #include "string/strcmp/streq.h" @@ -83,7 +84,6 @@ struct itemdef { {"MOTD_FIRSTONLY", NULL}, \ -#define NUMDEFS (sizeof(def_table)/sizeof(def_table[0])) static struct itemdef def_table[] = { {"CHFN_RESTRICT", NULL}, {"CONSOLE_GROUPS", NULL}, @@ -611,7 +611,7 @@ int main (int argc, char **argv) def_load (); - for (i = 0; i < NUMDEFS; ++i) { + for (i = 0; i < countof(def_table); ++i) { d = def_find (def_table[i].name, NULL); if (NULL == d) { printf ("error - lookup '%s' failed\n",