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