Skip to content

Commit 697c5fd

Browse files
lyakhnashif
authored andcommitted
llext: test-simple: replace ARRAY_SIZE() with sizeof()
When identifying the size of an extension image we simply need its size in bytes, not the number of array elements, that contain it. Both happen to return the same value, because we use arrays of bytes, but using sizeof() is clearer. Signed-off-by: Guennadi Liakhovetski <[email protected]>
1 parent 5332393 commit 697c5fd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/subsys/llext/simple/src/test_llext_simple.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ void load_call_unload(const struct llext_test *test_case)
241241
const struct llext_test test_case = { \
242242
.name = STRINGIFY(_name), \
243243
.buf = _name ## _ext, \
244-
.buf_len = ARRAY_SIZE(_name ## _ext), \
244+
.buf_len = sizeof(_name ## _ext), \
245245
extra_args \
246246
}; \
247247
load_call_unload(&test_case); \
@@ -328,7 +328,7 @@ static LLEXT_CONST uint8_t pre_located_ext[] ELF_ALIGN = {
328328
ZTEST(llext, test_pre_located)
329329
{
330330
struct llext_buf_loader buf_loader =
331-
LLEXT_BUF_LOADER(pre_located_ext, ARRAY_SIZE(pre_located_ext));
331+
LLEXT_BUF_LOADER(pre_located_ext, sizeof(pre_located_ext));
332332
struct llext_loader *loader = &buf_loader.loader;
333333
struct llext_load_param ldr_parm = LLEXT_LOAD_PARAM_DEFAULT;
334334
struct llext *ext = NULL;
@@ -364,7 +364,7 @@ ZTEST(llext, test_find_section)
364364
ssize_t section_ofs;
365365

366366
struct llext_buf_loader buf_loader =
367-
LLEXT_BUF_LOADER(find_section_ext, ARRAY_SIZE(find_section_ext));
367+
LLEXT_BUF_LOADER(find_section_ext, sizeof(find_section_ext));
368368
struct llext_loader *loader = &buf_loader.loader;
369369
struct llext_load_param ldr_parm = LLEXT_LOAD_PARAM_DEFAULT;
370370
struct llext *ext = NULL;

0 commit comments

Comments
 (0)