Kaynağa Gözat

u-a: Rename variable index to idx to not shadow index(3)

Guillem Jover 16 yıl önce
ebeveyn
işleme
a9746761e3
1 değiştirilmiş dosya ile 8 ekleme ve 8 silme
  1. 8 8
      utils/update-alternatives.c

+ 8 - 8
utils/update-alternatives.c

@@ -1409,7 +1409,7 @@ alternative_select_choice(struct alternative *a)
 {
 {
 	char *current, *ret, selection[_POSIX_PATH_MAX];
 	char *current, *ret, selection[_POSIX_PATH_MAX];
 	struct fileset *best, *fs;
 	struct fileset *best, *fs;
-	int len, index;
+	int len, idx;
 
 
 	current = alternative_get_current(a);
 	current = alternative_get_current(a);
 	best = alternative_get_best(a);
 	best = alternative_get_best(a);
@@ -1435,16 +1435,16 @@ alternative_select_choice(struct alternative *a)
 			mark = " ";
 			mark = " ";
 		pr("%s %-12d %-*s % -10d %s", mark, 0, len, best->master_file,
 		pr("%s %-12d %-*s % -10d %s", mark, 0, len, best->master_file,
 		   best->priority, _("auto mode"));
 		   best->priority, _("auto mode"));
-		index = 1;
+		idx = 1;
 		for (fs = a->choices; fs; fs = fs->next) {
 		for (fs = a->choices; fs; fs = fs->next) {
 			if (a->status == ALT_ST_MANUAL && current &&
 			if (a->status == ALT_ST_MANUAL && current &&
 			    strcmp(current, fs->master_file) == 0)
 			    strcmp(current, fs->master_file) == 0)
 				mark = "*";
 				mark = "*";
 			else
 			else
 				mark = " ";
 				mark = " ";
-			pr("%s %-12d %-*s % -10d %s", mark, index, len,
+			pr("%s %-12d %-*s % -10d %s", mark, idx, len,
 			   fs->master_file, fs->priority, _("manual mode"));
 			   fs->master_file, fs->priority, _("manual mode"));
-			index++;
+			idx++;
 		}
 		}
 		printf("\n");
 		printf("\n");
 		printf(_("Press enter to keep the current choice[*], "
 		printf(_("Press enter to keep the current choice[*], "
@@ -1457,16 +1457,16 @@ alternative_select_choice(struct alternative *a)
 		selection[strlen(selection) - 1] = '\0';
 		selection[strlen(selection) - 1] = '\0';
 		if (strlen(selection) == 0)
 		if (strlen(selection) == 0)
 			return current;
 			return current;
-		index = strtol(selection, &ret, 10);
+		idx = strtol(selection, &ret, 10);
 		if (*ret == '\0') {
 		if (*ret == '\0') {
 			/* Look up by index */
 			/* Look up by index */
-			if (index == 0) {
+			if (idx == 0) {
 				alternative_set_status(a, ALT_ST_AUTO);
 				alternative_set_status(a, ALT_ST_AUTO);
 				free(current);
 				free(current);
 				return xstrdup(best->master_file);
 				return xstrdup(best->master_file);
 			}
 			}
-			index--;
-			for (fs = a->choices; index && fs; index--)
+			idx--;
+			for (fs = a->choices; idx && fs; idx--)
 				fs = fs->next;
 				fs = fs->next;
 			if (fs) {
 			if (fs) {
 				alternative_set_status(a, ALT_ST_MANUAL);
 				alternative_set_status(a, ALT_ST_MANUAL);