Skip to content

Commit cbef04a

Browse files
committed
[components][libc][posix][libdl] Optimization: Redundant calculations in a for loop
1 parent b61f8b4 commit cbef04a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

components/libc/posix/libdl/dlelf.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,12 @@ rt_err_t dlmodule_load_shared_object(struct rt_dlmodule* module, void *module_pt
209209
}
210210

211211
/* construct module symbol table */
212+
rt_uint8_t *shstrab;
213+
shstrab = (rt_uint8_t *)module_ptr +
214+
shdr[elf_module->e_shstrndx].sh_offset;
212215
for (index = 0; index < elf_module->e_shnum; index ++)
213216
{
214217
/* find .dynsym section */
215-
rt_uint8_t *shstrab;
216-
shstrab = (rt_uint8_t *)module_ptr +
217-
shdr[elf_module->e_shstrndx].sh_offset;
218218
if (rt_strcmp((const char *)(shstrab + shdr[index].sh_name), ELF_DYNSYM) == 0)
219219
break;
220220
}

0 commit comments

Comments
 (0)