mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 18:14:25 +03:00
(user_menu_cmd): minor refactoring.
Fix comparison of integer expressions of different signedness. Reduce variable scope. Signed-off-by: Andrew Borodin <aborodin@vmail.ru> Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
This commit is contained in:
parent
1719f3383f
commit
b4f4618994
@ -977,7 +977,6 @@ user_menu_cmd (const Widget *edit_widget, const char *menu_file, int selected_en
|
||||
GPtrArray *entries = NULL;
|
||||
int max_cols = 0;
|
||||
int col = 0;
|
||||
int i;
|
||||
gboolean accept_entry = TRUE;
|
||||
int selected = 0;
|
||||
gboolean old_patterns;
|
||||
@ -1038,7 +1037,7 @@ user_menu_cmd (const Widget *edit_widget, const char *menu_file, int selected_en
|
||||
/* Parse the menu file */
|
||||
for (p = check_patterns (data); *p != '\0'; str_next_char (&p))
|
||||
{
|
||||
int menu_lines = entries == NULL ? 0 : entries->len;
|
||||
unsigned int menu_lines = entries == NULL ? 0 : entries->len;
|
||||
|
||||
if (col == 0 && (entries == NULL || menu_lines == entries->len))
|
||||
switch (*p)
|
||||
@ -1077,9 +1076,10 @@ user_menu_cmd (const Widget *edit_widget, const char *menu_file, int selected_en
|
||||
else
|
||||
{
|
||||
/* A condition for making the entry default */
|
||||
i = 1;
|
||||
p = test_line (edit_widget, p, &i);
|
||||
if (selected == 0 && i != 0)
|
||||
gboolean ok = TRUE;
|
||||
|
||||
p = test_line (edit_widget, p, &ok);
|
||||
if (selected == 0 && ok)
|
||||
selected = menu_lines;
|
||||
}
|
||||
break;
|
||||
@ -1124,6 +1124,7 @@ user_menu_cmd (const Widget *edit_widget, const char *menu_file, int selected_en
|
||||
else
|
||||
{
|
||||
Listbox *listbox;
|
||||
unsigned int i;
|
||||
|
||||
max_cols = MIN (MAX (max_cols, col), MAX_ENTRY_LEN);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user