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