Skip to content

Commit

Permalink
kconfig: squash menu_has_help() and menu_get_help()
Browse files Browse the repository at this point in the history
menu_has_help() and menu_get_help() functions are only used within
menu_get_ext_help().

Squash them into menu_get_ext_help(). It revealed the if-conditional
in menu_get_help() was unneeded, as menu_has_help() has already checked
that menu->help is not NULL.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
  • Loading branch information
Masahiro Yamada committed Dec 28, 2023
1 parent 6c07fd8 commit 092e39d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
2 changes: 0 additions & 2 deletions scripts/kconfig/lkc.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ bool menu_is_visible(struct menu *menu);
bool menu_has_prompt(struct menu *menu);
const char *menu_get_prompt(struct menu *menu);
struct menu *menu_get_parent_menu(struct menu *menu);
bool menu_has_help(struct menu *menu);
const char *menu_get_help(struct menu *menu);
int get_jump_key_char(void);
struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head);
void menu_get_ext_help(struct menu *menu, struct gstr *help);
Expand Down
17 changes: 2 additions & 15 deletions scripts/kconfig/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -673,19 +673,6 @@ struct menu *menu_get_parent_menu(struct menu *menu)
return menu;
}

bool menu_has_help(struct menu *menu)
{
return menu->help != NULL;
}

const char *menu_get_help(struct menu *menu)
{
if (menu->help)
return menu->help;
else
return "";
}

static void get_def_str(struct gstr *r, struct menu *menu)
{
str_printf(r, "Defined at %s:%d\n",
Expand Down Expand Up @@ -856,10 +843,10 @@ void menu_get_ext_help(struct menu *menu, struct gstr *help)
struct symbol *sym = menu->sym;
const char *help_text = nohelp_text;

if (menu_has_help(menu)) {
if (menu->help) {
if (sym->name)
str_printf(help, "%s%s:\n\n", CONFIG_, sym->name);
help_text = menu_get_help(menu);
help_text = menu->help;
}
str_printf(help, "%s\n", help_text);
if (sym)
Expand Down

0 comments on commit 092e39d

Please sign in to comment.