Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rtla: Use str_has_prefix() for option prefix check

The argument parsing code in timerlat_main() and osnoise_main() uses
strncmp() with a length of 1 to check if the first argument starts
with a dash, indicating an option flag was passed.

Replace this pattern with str_has_prefix() for consistency with the
rest of the codebase. While character comparison would be slightly
more efficient, using str_has_prefix() provides better readability
and maintains a uniform coding style throughout the rtla tool.

Signed-off-by: Wander Lairson Costa <wander@redhat.com>
Link: https://lore.kernel.org/r/20260309195040.1019085-14-wander@redhat.com
Signed-off-by: Tomas Glozar <tglozar@redhat.com>

authored by

Wander Lairson Costa and committed by
Tomas Glozar
ea5ea835 b3910a73

+2 -2
+1 -1
tools/tracing/rtla/src/osnoise.c
··· 1210 1210 1211 1211 if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0)) { 1212 1212 osnoise_usage(0); 1213 - } else if (strncmp(argv[1], "-", 1) == 0) { 1213 + } else if (str_has_prefix(argv[1], "-")) { 1214 1214 /* the user skipped the tool, call the default one */ 1215 1215 run_tool(&osnoise_top_ops, argc, argv); 1216 1216 exit(0);
+1 -1
tools/tracing/rtla/src/timerlat.c
··· 269 269 270 270 if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0)) { 271 271 timerlat_usage(0); 272 - } else if (strncmp(argv[1], "-", 1) == 0) { 272 + } else if (str_has_prefix(argv[1], "-")) { 273 273 /* the user skipped the tool, call the default one */ 274 274 run_tool(&timerlat_top_ops, argc, argv); 275 275 exit(0);