From 1b4d2938c4b7cf8d166561214bf12a44c345258d Mon Sep 17 00:00:00 2001 From: Robert Marshall Date: Thu, 8 Dec 2016 13:39:22 -0500 Subject: [PATCH 61/69] 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 ab2c025..344f1da 100644 --- a/grubby.c +++ b/grubby.c @@ -2589,19 +2589,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; @@ -2629,7 +2629,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 */ @@ -2638,7 +2638,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 bad -- 2.9.3