]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
gunit/012: use ARRAY_SIZE() macro
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Tue, 8 Aug 2023 10:56:53 +0000 (16:26 +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>
tests/gunit/012-cgroup_create_cgroup.cpp

index dbe7c5342814489d464ff491dd4503caebb42833..1d771058ba2ad5af8bc041f3e5119280c77c1bf8 100644 (file)
@@ -23,8 +23,7 @@ static const char * const CONTROLLERS[] = {
        "namespaces",
        "netns",
 };
-static const int CONTROLLERS_CNT =
-       sizeof(CONTROLLERS) / sizeof(CONTROLLERS[0]);
+static const int CONTROLLERS_CNT = ARRAY_SIZE(CONTROLLERS);
 
 static cg_version_t VERSIONS[] = {
        CGROUP_V1,
@@ -34,8 +33,7 @@ static cg_version_t VERSIONS[] = {
        CGROUP_V1,
        CGROUP_V2,
 };
-static const int VERSIONS_CNT =
-       sizeof(VERSIONS) / sizeof(VERSIONS[0]);
+static const int VERSIONS_CNT = ARRAY_SIZE(VERSIONS);
 
 class CgroupCreateCgroupTest : public ::testing::Test {
        protected: