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

u-a: Simplify an unify string in alternative_display_query()

Unify the common string, and always call free() as it handles NULL just
fine.
Guillem Jover лет назад: 15
Родитель
Сommit
befa6d2158
1 измененных файлов с 2 добавлено и 6 удалено
  1. 2 6
      utils/update-alternatives.c

+ 2 - 6
utils/update-alternatives.c

@@ -1392,12 +1392,8 @@ alternative_display_query(struct alternative *a)
 	if (best)
 		pr("Best: %s", best->master_file);
 	current = alternative_get_current(a);
-	if (current) {
-		pr("Value: %s", current);
-		free(current);
-	} else {
-		pr("Value: none");
-	}
+	pr("Value: %s", current ? current : "none");
+	free(current);
 
 	for (fs = a->choices; fs; fs = fs->next) {
 		printf("\n");