sys: util: Change return type of ARRAY_SIZE to size_t
The ARRAY_SIZE macro uses sizeof and thus the return type should be an unsigned value. size_t is typically the type used for sizeof and fits well for the ARRAY_SIZE macro as well. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
14877fd6a6
commit
ae55dae454
10 changed files with 15 additions and 15 deletions
|
@ -133,7 +133,7 @@ static int test_task(uint32_t chan_id, uint32_t blen, uint32_t block_count)
|
|||
};
|
||||
|
||||
if (block_count > ARRAY_SIZE(transfer_blocks)) {
|
||||
printk("block_count %u is greater than %ld\n", block_count,
|
||||
printk("block_count %u is greater than %zu\n", block_count,
|
||||
ARRAY_SIZE(transfer_blocks));
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -1922,7 +1922,7 @@ static void test_dep_ord(void)
|
|||
};
|
||||
zassert_equal(ARRAY_SIZE(children_combined_ords),
|
||||
ARRAY_SIZE(children_combined_ords_expected),
|
||||
"%u", ARRAY_SIZE(children_combined_ords));
|
||||
"%zu", ARRAY_SIZE(children_combined_ords));
|
||||
for (i = 0; i < ARRAY_SIZE(children_combined_ords); i++) {
|
||||
zassert_equal(children_combined_ords[i],
|
||||
children_combined_ords_expected[i],
|
||||
|
@ -1949,7 +1949,7 @@ static void test_dep_ord(void)
|
|||
};
|
||||
zassert_equal(ARRAY_SIZE(child_a_combined_ords),
|
||||
ARRAY_SIZE(child_a_combined_ords_expected),
|
||||
"%u", ARRAY_SIZE(child_a_combined_ords));
|
||||
"%zu", ARRAY_SIZE(child_a_combined_ords));
|
||||
for (i = 0; i < ARRAY_SIZE(child_a_combined_ords); i++) {
|
||||
zassert_equal(child_a_combined_ords[i],
|
||||
child_a_combined_ords_expected[i],
|
||||
|
|
|
@ -368,17 +368,17 @@ static void test_virtual_setup(void)
|
|||
|
||||
zassert_equal(ud.virtual_if_count, ARRAY_SIZE(virtual_interfaces),
|
||||
"Invalid number of virtual interfaces, "
|
||||
"was %d should be %d",
|
||||
"was %d should be %zu",
|
||||
ud.virtual_if_count, ARRAY_SIZE(virtual_interfaces));
|
||||
|
||||
zassert_true(ud.eth_if_count <= ARRAY_SIZE(eth_interfaces),
|
||||
"Invalid number of eth interfaces, "
|
||||
"was %d should be %d",
|
||||
"was %d should be %zu",
|
||||
ud.eth_if_count, ARRAY_SIZE(eth_interfaces));
|
||||
|
||||
zassert_equal(ud.dummy_if_count, ARRAY_SIZE(dummy_interfaces),
|
||||
"Invalid number of dummy interfaces, "
|
||||
"was %d should be %d",
|
||||
"was %d should be %zu",
|
||||
ud.dummy_if_count, ARRAY_SIZE(dummy_interfaces));
|
||||
}
|
||||
|
||||
|
|
|
@ -337,7 +337,7 @@ static void test_FOR_EACH_IDX(void)
|
|||
FOR_EACH_IDX(FOR_EACH_IDX_MACRO_TEST3, (,), 1, 2, 3)
|
||||
};
|
||||
|
||||
zassert_equal(ARRAY_SIZE(a), 3, "Unexpected value:%d", ARRAY_SIZE(a));
|
||||
zassert_equal(ARRAY_SIZE(a), 3, "Unexpected value:%zu", ARRAY_SIZE(a));
|
||||
}
|
||||
|
||||
static void test_FOR_EACH_IDX_FIXED_ARG(void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue