From 52c063713eb24020f4863a1e643296bac1cfe40d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 28 Aug 2026 14:42:38 +0200 Subject: [PATCH] shared/verbs: drop unused variable Also add a note that the function does not support multiple groups. I think that's fair, it doesn't make sense to generalize the functionality when we're unlikely to ever use that. (Verb options are only used by udevadm right now.) --- src/shared/options.c | 4 ++-- src/shared/verbs.c | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/shared/options.c b/src/shared/options.c index 905307f88d..f92eabc1e6 100644 --- a/src/shared/options.c +++ b/src/shared/options.c @@ -525,7 +525,6 @@ int options_get_help_table_group( int r; assert(ret); - assert(ret_group); _cleanup_(table_unrefp) Table *table = NULL; @@ -594,7 +593,8 @@ int options_get_help_table_group( } *ret = TAKE_PTR(table); - *ret_group = group; + if (ret_group) + *ret_group = group; assert(opt - options < INT_MAX); return opt - options; diff --git a/src/shared/verbs.c b/src/shared/verbs.c index d152fdb7d9..c79659467b 100644 --- a/src/shared/verbs.c +++ b/src/shared/verbs.c @@ -641,11 +641,16 @@ int _command_print_verb_help( "Option namespace %s not found.", verb->option_namespace); _cleanup_(table_unrefp) Table *table = NULL; - const char *group; - r = options_get_help_table_group(optns, options_end, /* option_groups= */ NULL, &table, &group); + r = options_get_help_table_group( + optns, options_end, + /* option_groups= */ NULL, + &table, + /* ret_group= */ NULL); if (r < 0) return r; + /* Note: we assume that only one option group is used for a verb. If this ever + * stops being true, the code here would need to be adjusted to loop over groups. */ help_section("Options"); r = table_print_or_warn(table); if (r < 0)