mirror_zfs/udev
rilysh 86737c5927
Avoid computing strlen() inside loops
Compiling with -O0 (no proper optimizations), strlen() call
in loops for comparing the size, isn't being called/initialized
before the actual loop gets started, which causes n-numbers of
strlen() calls (as long as the string is). Keeping the length
before entering in the loop is a good idea.

On some places, even with -O2, both GCC and Clang can't
recognize this pattern, which seem to happen in an array
of char pointer.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: rilysh <nightquick@proton.me>
Closes #16584
2024-10-02 09:10:06 -07:00
..
rules.d autoconf: use include directives instead of recursing down udev 2022-05-10 10:19:36 -07:00
.gitignore cmd: move single-file binaries up, extract udev programs to udev/ 2022-05-10 10:20:34 -07:00
Makefile.am cmd: move single-file binaries up, extract udev programs to udev/ 2022-05-10 10:20:34 -07:00
vdev_id cmd: move single-file binaries up, extract udev programs to udev/ 2022-05-10 10:20:34 -07:00
zvol_id.c Avoid computing strlen() inside loops 2024-10-02 09:10:06 -07:00