tweaks: rename some variables from a single letter to meaningful word

master
Benno Schulenberg 2019-02-10 15:40:08 +01:00
parent 14f32577ee
commit ebfe752841
4 changed files with 21 additions and 21 deletions

View File

@ -2106,7 +2106,7 @@ int do_writeout(bool exiting, bool withprompt)
while (TRUE) {
const char *msg;
int i = 0;
int choice = 0;
functionptrtype func;
#ifndef NANO_TINY
const char *formatstr, *backupstr;
@ -2139,7 +2139,7 @@ int do_writeout(bool exiting, bool withprompt)
else {
/* Ask for (confirmation of) the filename. Disable tab completion
* when using restricted mode and the filename isn't blank. */
i = do_prompt(!ISSET(RESTRICTED) || openfile->filename[0] == '\0',
choice = do_prompt(!ISSET(RESTRICTED) || openfile->filename[0] == '\0',
TRUE, MWRITEFILE, given, NULL,
edit_refresh, "%s%s%s", msg,
#ifndef NANO_TINY
@ -2150,12 +2150,12 @@ int do_writeout(bool exiting, bool withprompt)
);
}
if (i < 0) {
if (choice < 0) {
statusbar(_("Cancelled"));
break;
}
func = func_from_key(&i);
func = func_from_key(&choice);
/* Upon request, abandon the buffer. */
if (func == discard_buffer) {
@ -2267,12 +2267,12 @@ int do_writeout(bool exiting, bool withprompt)
sprintf(message, question, name);
i = do_yesno_prompt(FALSE, message);
choice = do_yesno_prompt(FALSE, message);
free(message);
free(name);
if (i < 1)
if (choice < 1)
continue;
}
}

View File

@ -1037,16 +1037,16 @@ void version(void)
* buffer is open, exit from nano. */
void do_exit(void)
{
int i;
int choice;
/* If the file hasn't been modified, pretend the user chose not to
* save. */
if (!openfile->modified)
i = 0;
choice = 0;
/* If the TEMP_FILE flag is set and the current file has a name,
* pretend the user chose to save. */
else if (openfile->filename[0] != '\0' && ISSET(TEMP_FILE))
i = 1;
choice = 1;
/* Otherwise, ask the user whether or not to save. */
else {
/* If the TEMP_FILE flag is set, and the current file doesn't
@ -1054,15 +1054,15 @@ void do_exit(void)
if (ISSET(TEMP_FILE))
warn_and_shortly_pause(_("No file name"));
i = do_yesno_prompt(FALSE, _("Save modified buffer? "
choice = do_yesno_prompt(FALSE, _("Save modified buffer? "
"(Answering \"No\" will DISCARD changes.) "));
}
/* If the user chose not to save, or if the user chose to save and
* the save succeeded, we're ready to exit. */
if (i == 0 || (i == 1 && do_writeout(TRUE, TRUE) > 0))
if (choice == 0 || (choice == 1 && do_writeout(TRUE, TRUE) > 0))
close_and_go();
else if (i != 1)
else if (choice != 1)
statusbar(_("Cancelled"));
}

View File

@ -548,7 +548,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
came_full_circle = FALSE;
while (TRUE) {
int i = 0;
int choice = 0;
int result = findnextstr(needle, whole_word_only, modus,
&match_len, skipone, real_current, *real_current_x);
@ -585,21 +585,21 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
edit_refresh();
/* TRANSLATORS: This is a prompt. */
i = do_yesno_prompt(TRUE, _("Replace this instance?"));
choice = do_yesno_prompt(TRUE, _("Replace this instance?"));
spotlighted = FALSE;
if (i == -1) /* The replacing was cancelled. */
if (choice == -1) /* The replacing was cancelled. */
break;
else if (i == 2)
else if (choice == 2)
replaceall = TRUE;
/* When "No" or moving backwards, the search routine should
* first move one character further before continuing. */
skipone = (i == 0 || ISSET(BACKWARDS_SEARCH));
skipone = (choice == 0 || ISSET(BACKWARDS_SEARCH));
}
if (i == 1 || replaceall) { /* Yes, replace it. */
if (choice == 1 || replaceall) { /* Yes, replace it. */
char *copy;
size_t length_change;

View File

@ -2632,12 +2632,12 @@ void do_linter(void)
edit_refresh();
if (openfile->modified) {
int i = do_yesno_prompt(FALSE, _("Save modified buffer before linting?"));
int choice = do_yesno_prompt(FALSE, _("Save modified buffer before linting?"));
if (i == -1) {
if (choice == -1) {
statusbar(_("Cancelled"));
return;
} else if (i == 1 && (do_writeout(FALSE, FALSE) != 1))
} else if (choice == 1 && (do_writeout(FALSE, FALSE) != 1))
return;
}