]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
src/api.c: use ARRAY_SIZE() macro
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Tue, 8 Aug 2023 10:16:03 +0000 (15:46 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Thu, 10 Aug 2023 15:56:48 +0000 (09:56 -0600)
Use ARRAY_SIZE() macro to calculate the length of the array, across the
file.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/api.c

index f2991a40cbbb3c4fcba2a05a205c985c22ca6b6e..4bfaf011cff4f313fdd67972191dfbbaa387b3bb 100644 (file)
--- a/src/api.c
+++ b/src/api.c
@@ -4994,7 +4994,7 @@ const char *cgroup_strerror(int code)
                        "unknown error" : errtext;
 #endif
        }
-       if (idx >= sizeof(cgroup_strerror_codes)/sizeof(cgroup_strerror_codes[0]))
+       if (idx >= ARRAY_SIZE(cgroup_strerror_codes))
                return "Invalid error code";
 
        return cgroup_strerror_codes[idx];