903092
From 1b4d2938c4b7cf8d166561214bf12a44c345258d Mon Sep 17 00:00:00 2001
903092
From: Robert Marshall <rmarshall@redhat.com>
903092
Date: Thu, 8 Dec 2016 13:39:22 -0500
903092
Subject: [PATCH 61/69] Rename setDefaultImage variables
903092
903092
The variable names in setDefaultImage did not match well with
903092
how they were being used inside the function. Refactored the
903092
variable names as a precursor to refactoring the function.
903092
903092
Related: rhbz#1285601
903092
---
903092
 grubby.c | 18 +++++++++---------
903092
 1 file changed, 9 insertions(+), 9 deletions(-)
903092
903092
diff --git a/grubby.c b/grubby.c
903092
index ab2c025..344f1da 100644
903092
--- a/grubby.c
903092
+++ b/grubby.c
903092
@@ -2589,19 +2589,19 @@ void markRemovedImage(struct grubConfig *cfg, const char *image,
903092
 		entry->skip = 1;
903092
 }
903092
 
903092
-void setDefaultImage(struct grubConfig *config, int hasNew,
903092
-		     const char *defaultKernelPath, int newIsDefault,
903092
-		     const char *prefix, int flags, int index)
903092
+void setDefaultImage(struct grubConfig *config, int isUserSpecifiedKernelPath,
903092
+		     const char *defaultKernelPath, int newBootEntryIsDefault,
903092
+		     const char *prefix, int flags, int newDefaultBootEntryIndex)
903092
 {
903092
 	struct singleEntry *entry, *entry2, *newDefault;
903092
 	int i, j;
903092
 
903092
-	if (newIsDefault) {
903092
+	if (newBootEntryIsDefault) {
903092
 		config->defaultImage = 0;
903092
 		return;
903092
-	} else if ((index >= 0) && config->cfi->defaultIsIndex) {
903092
-		if (findEntryByIndex(config, index))
903092
-			config->defaultImage = index;
903092
+	} else if ((newDefaultBootEntryIndex >= 0) && config->cfi->defaultIsIndex) {
903092
+		if (findEntryByIndex(config, newDefaultBootEntryIndex))
903092
+			config->defaultImage = newDefaultBootEntryIndex;
903092
 		else
903092
 			config->defaultImage = -1;
903092
 		return;
903092
@@ -2629,7 +2629,7 @@ void setDefaultImage(struct grubConfig *config, int hasNew,
903092
 
903092
 	if (entry && !entry->skip) {
903092
 		/* we can preserve the default */
903092
-		if (hasNew)
903092
+		if (isUserSpecifiedKernelPath)
903092
 			config->defaultImage++;
903092
 
903092
 		/* count the number of entries erased before this one */
903092
@@ -2638,7 +2638,7 @@ void setDefaultImage(struct grubConfig *config, int hasNew,
903092
 			if (entry2->skip)
903092
 				config->defaultImage--;
903092
 		}
903092
-	} else if (hasNew) {
903092
+	} else if (isUserSpecifiedKernelPath) {
903092
 		config->defaultImage = 0;
903092
 	} else {
903092
 		/* Either we just erased the default (or the default line was bad
903092
-- 
903092
2.9.3
903092