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