]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rv/rvgen: use class constant for init marker
authorWander Lairson Costa <wander@redhat.com>
Mon, 23 Feb 2026 16:17:53 +0000 (13:17 -0300)
committerGabriele Monaco <gmonaco@redhat.com>
Wed, 1 Apr 2026 08:16:18 +0000 (10:16 +0200)
commitd474fedcc53aebd584dfc1a42ccb78329ca68aa0
tree91f3ae1808d8df85bc859077ff2687337ff6fef7
parent5d5a7d88185bc7c99328a29498efb3154e2d23d7
rv/rvgen: use class constant for init marker

Replace hardcoded string literal and magic number with a class
constant for the initial state marker in DOT file parsing. The
previous implementation used the magic string "__init_" directly
in the code along with a hardcoded length of 7 for substring
extraction, which made the code less maintainable and harder to
understand.

This change introduces a class constant init_marker to serve as
a single source of truth for the initial state prefix. The code
now uses startswith() for clearer intent and calculates the
substring position dynamically using len(), eliminating the magic
number. If the marker value needs to change in the future, only
the constant definition requires updating rather than multiple
locations in the code.

The refactoring improves code readability and maintainability
while preserving the exact same runtime behavior.

Signed-off-by: Wander Lairson Costa <wander@redhat.com>
Reviewed-by: Gabriele Monaco <gmonaco@redhat.com>
Reviewed-by: Nam Cao <namcao@linutronix.de>
Link: https://lore.kernel.org/r/20260223162407.147003-11-wander@redhat.com
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
tools/verification/rvgen/rvgen/automata.py