]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/getdef.c: Use countof() instead of its pattern
authorAlejandro Colomar <alx@kernel.org>
Wed, 28 May 2025 11:52:12 +0000 (13:52 +0200)
committerSerge Hallyn <serge@hallyn.com>
Tue, 3 Jun 2025 14:34:55 +0000 (09:34 -0500)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/getdef.c

index 9cc8bbfe50c7c7a785e62f6b1819752a906eaae9..84bc939b88825d9142a7ed5175b2e5d55422fde4 100644 (file)
@@ -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",