Просмотр исходного кода

u-a: Unify idx handling in alternative_select_choice()

Make it obvious the 0 passed to alternative_print_choice() is the idx,
and move the increment in the for loop into the post action.
Guillem Jover лет назад: 13
Родитель
Сommit
f2e2ab4bd1
1 измененных файлов с 3 добавлено и 5 удалено
  1. 3 5
      utils/update-alternatives.c

+ 3 - 5
utils/update-alternatives.c

@@ -1608,12 +1608,10 @@ alternative_select_choice(struct alternative *a)
 		pr("  %-12.12s %-*.*s %-10.10s %s", _("Selection"), len, len,
 		   _("Path"), _("Priority"), _("Status"));
 		pr("------------------------------------------------------------");
-		alternative_print_choice(a, ALT_ST_AUTO, best, 0, len);
-		idx = 1;
-		for (fs = a->choices; fs; fs = fs->next) {
+		idx = 0;
+		alternative_print_choice(a, ALT_ST_AUTO, best, idx++, len);
+		for (fs = a->choices; fs; fs = fs->next, idx++)
 			alternative_print_choice(a, ALT_ST_MANUAL, fs, idx, len);
-			idx++;
-		}
 		printf("\n");
 		printf(_("Press enter to keep the current choice[*], "
 		         "or type selection number: "));