]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rtla: Use str_has_prefix() for prefix checks
authorWander Lairson Costa <wander@redhat.com>
Mon, 9 Mar 2026 19:46:24 +0000 (16:46 -0300)
committerTomas Glozar <tglozar@redhat.com>
Wed, 11 Mar 2026 14:29:50 +0000 (15:29 +0100)
commit265905df83a4c1e78c1a912e1699d7c81d9540e6
tree078b03fe1c80bd08ae7ddb6d45f1ea71b2f94b1e
parent0f4bc9d67a643a6ea8b82faf724e44648b2c322d
rtla: Use str_has_prefix() for prefix checks

The code currently uses strncmp() combined with strlen() to check if a
string starts with a specific prefix. This pattern is verbose and prone
to errors if the length does not match the prefix string.

Replace this pattern with the str_has_prefix() helper function in both
trace.c and utils.c. This improves code readability and safety by
handling the prefix length calculation automatically.

In addition, remove the unused retval variable from
trace_event_save_hist() in trace.c to clean up the function and
silence potential compiler warnings.

Signed-off-by: Wander Lairson Costa <wander@redhat.com>
Link: https://lore.kernel.org/r/20260309195040.1019085-12-wander@redhat.com
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
tools/tracing/rtla/src/trace.c
tools/tracing/rtla/src/utils.c