]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
src/abstraction-map.c: use ARRAY_SIZE() macro
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Tue, 8 Aug 2023 10:15:56 +0000 (15:45 +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/abstraction-map.c

index 1735e364ea7bc4e40dfc7022cfaab498eddb3c00..3e63b9d5f8a720c9ee7d2733ac5eaa614d1ac2a0 100644 (file)
@@ -42,7 +42,7 @@ const struct cgroup_abstraction_map cgroup_v1_to_v2_map[] = {
        {cgroup_convert_unmappable, "cpuset.sched_load_balance", NULL, NULL, NULL},
        {cgroup_convert_unmappable, "cpuset.sched_relax_domain_level", NULL, NULL, NULL},
 };
-const int cgroup_v1_to_v2_map_sz = sizeof(cgroup_v1_to_v2_map) / sizeof(cgroup_v1_to_v2_map[0]);
+const int cgroup_v1_to_v2_map_sz = ARRAY_SIZE(cgroup_v1_to_v2_map);
 
 const struct cgroup_abstraction_map cgroup_v2_to_v1_map[] = {
        /* cpu controller */
@@ -59,4 +59,4 @@ const struct cgroup_abstraction_map cgroup_v2_to_v1_map[] = {
        {cgroup_convert_cpuset_to_exclusive, "cpuset.cpus.partition", NULL,
                "cpuset.cpu_exclusive", NULL},
 };
-const int cgroup_v2_to_v1_map_sz = sizeof(cgroup_v2_to_v1_map) / sizeof(cgroup_v2_to_v1_map[0]);
+const int cgroup_v2_to_v1_map_sz = ARRAY_SIZE(cgroup_v2_to_v1_map);