File tree Expand file tree Collapse file tree 2 files changed +20
-7
lines changed Expand file tree Collapse file tree 2 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ bool sym_string_valid(struct symbol *sym, const char *newval);
3434bool sym_string_within_range (struct symbol * sym , const char * str );
3535bool sym_set_string_value (struct symbol * sym , const char * newval );
3636bool sym_is_changeable (const struct symbol * sym );
37+ struct menu * sym_get_prompt_menu (const struct symbol * sym );
3738struct menu * sym_get_choice_menu (const struct symbol * sym );
3839const char * sym_get_string_value (struct symbol * sym );
3940
Original file line number Diff line number Diff line change @@ -70,6 +70,24 @@ const char *sym_type_name(enum symbol_type type)
7070 return "???" ;
7171}
7272
73+ /**
74+ * sym_get_prompt_menu - get the menu entry with a prompt
75+ *
76+ * @sym: a symbol pointer
77+ *
78+ * Return: the menu entry with a prompt.
79+ */
80+ struct menu * sym_get_prompt_menu (const struct symbol * sym )
81+ {
82+ struct menu * m ;
83+
84+ list_for_each_entry (m , & sym -> menus , link )
85+ if (m -> prompt )
86+ return m ;
87+
88+ return NULL ;
89+ }
90+
7391/**
7492 * sym_get_choice_menu - get the parent choice menu if present
7593 *
@@ -80,18 +98,12 @@ const char *sym_type_name(enum symbol_type type)
8098struct menu * sym_get_choice_menu (const struct symbol * sym )
8199{
82100 struct menu * menu = NULL ;
83- struct menu * m ;
84101
85102 /*
86103 * Choice members must have a prompt. Find a menu entry with a prompt,
87104 * and assume it resides inside a choice block.
88105 */
89- list_for_each_entry (m , & sym -> menus , link )
90- if (m -> prompt ) {
91- menu = m ;
92- break ;
93- }
94-
106+ menu = sym_get_prompt_menu (sym );
95107 if (!menu )
96108 return NULL ;
97109
You can’t perform that action at this time.
0 commit comments