]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: (test_strerror.c) use ARRAY_SIZE for better readability/portability
authorChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Tue, 31 Mar 2026 15:59:13 +0000 (11:59 -0400)
committerChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Tue, 31 Mar 2026 16:00:20 +0000 (12:00 -0400)
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
tests/helpers/test_strerror.c

index 7fcba1fed57be8adc7695244a8cb96ad9545a347..3775a46a33fc90676a3ce31b200713fd47019ff6 100644 (file)
@@ -13,6 +13,8 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "c.h"
+
 #define E(x) { #x, x }
 static struct {
        const char *str;
@@ -34,7 +36,7 @@ int main(int argc, const char *argv[])
                return -1;
        }
 
-       for (i = 0; i < sizeof(errors)/sizeof(*errors); i++) {
+       for (i = 0; i < ARRAY_SIZE(errors); i++) {
                if (strcmp(errors[i].str, argv[1]) != 0)
                        continue;
                puts(strerror(errors[i].error));