]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rtla/actions: Simplify argument parsing
authorWander Lairson Costa <wander@redhat.com>
Mon, 9 Mar 2026 19:46:16 +0000 (16:46 -0300)
committerTomas Glozar <tglozar@redhat.com>
Tue, 10 Mar 2026 09:32:37 +0000 (10:32 +0100)
commit989e5b8f0c5302cfb233fa2db49f8877b5f1352d
tree49d902edd9b15dc5b057608f28ab593038931d5e
parentb8f7f49a23897fc772373da513a1cb6d51e5958e
rtla/actions: Simplify argument parsing

The actions_parse() function uses open-coded logic to extract arguments
from a string. This includes manual length checks and strncmp() calls,
which can be verbose and error-prone.

To simplify and improve the robustness of argument parsing, introduce a
new extract_arg() helper macro. This macro extracts the value from a
"key=value" pair, making the code more concise and readable.

Also, introduce STRING_LENGTH() and strncmp_static() macros to
perform compile-time calculations of string lengths and safer string
comparisons.

Refactor actions_parse() to use these new helpers, resulting in
cleaner and more maintainable code.

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